I have a annoying problem that have been bother me almost the whole day, and I cant figure out what the problem is.
Sometimes its working, other times when I run the script it gives me error attempt to index a nil value, I understand that it rending different since there are two randomiser. But it should give me correct output. This is what I have.
The error always point out the first row in my variables, on this script its pointing
local surf_price = fastpris_plan[rnd_phone_surf_plan]['surf_price']
local phones_priceplan = {
{ priceplan = 'Fastpris'},
{ priceplan = 'Fastpris Mini'},
}
local rnd_priceplan = math.random(1, #phones_priceplan)
local priceplan = phones_priceplan[rnd_priceplan]['priceplan']
if priceplan == "Fastpris" then
local fastpris_plan =
{ surf_price = '145', gb = '0.5', hashkey2 ='00G', hashkey3 ='00K',hashkey4 ='00Q', },
{ surf_price = '195', gb = '2', hashkey2 ='00G', hashkey3 ='00K',hashkey4 ='00R', },
{ surf_price = '245', gb = '6', hashkey2 ='00G', hashkey3 ='00K',hashkey4 ='00S' }
elseif priceplan == "Fastpris Mini" then
local fastpris_plan =
{ plan ='Fastpris Mini', surf_price = '95', gb = '1', hashkey2 ='00G', hashkey3 ='00L',hashkey4 ='010', }
local rnd_phone_surf_plan = math.random(1, #fastpris_plan)
local surf_price = fastpris_plan[rnd_phone_surf_plan]['surf_price']
local gb = fastpris_plan[rnd_phone_surf_plan]['gb']
local hashkey2 = fastpris_plan[rnd_phone_surf_plan]['hashkey2']
local hashkey3 = fastpris_plan[rnd_phone_surf_plan]['hashkey3']
local hashkey4 = fastpris_plan[rnd_phone_surf_plan]['hashkey4']
end
Any suggestions on what's going on :)?
Thanks again
Aucun commentaire:
Enregistrer un commentaire