• if and statements
    4 replies, posted
How do I make it if 2 variable are true then it will do a function after that if variable and variable == 1 then blank
[lua] if(a == true && b == 2) then doSomething() end [/lua]
[QUOTE=gonzalolog;45265955][lua] if(a == true && b == 2) then doSomething() end [/lua][/QUOTE] Why do == true? [editline]1st July 2014[/editline] You can just do [lua]if ( a and b == 2 ) then[/lua]
[QUOTE=code_gs;45266035]Why do == true? [editline]1st July 2014[/editline] You can just do [lua]if ( a and b == 2 ) then[/lua][/QUOTE] Just for clarify that the value it's true and not nil
the statement will evaluate to false if a value is nil
Sorry, you need to Log In to post a reply to this thread.