mardi 22 septembre 2015

if-else block in lua script

I'm trying to create an if else statement in LUA script. But I cant really get it to work :( This is what I have.

First I have a randomizer that can choose between some plans

local phones_priceplan = {
    { priceplan = 'Fast'},
    { priceplan = 'Mini'},
    { priceplan = 'kort'},
}
local rnd_priceplan     =   math.random(1, #phones_priceplan)
local priceplan         =   phones_priceplan[rnd_priceplan]['priceplan']

Then if the priceplan is equal to 'Fast' I want to run another randomiser

if priceplan == "Fastpris"
    local fastpris_plan = {
        {   price = '145',  gb = '0.5', },
        {   price = '195',  gb = '2',   },
        {   price = '245',  gb = '6',   },

    }
    local rnd_phone_surf_plan       =   math.random(1, #fastpris_plan)
    local surf_price            =   fastpris_plan[rnd_phone_surf_plan]['surf_price']
end

But is with the if statement that it seems so crash. Any ideas on what could possible be wrong :)?

Aucun commentaire:

Enregistrer un commentaire