i want to know if it is possible to put an if statement into a variable? if so how?
example of what i want to do
x = if i < 1 then
rs.setOutput("side", true)
end
an if statement is a variable
Started by darkmists, Apr 06 2013 06:20 AM
8 replies to this topic
#1
Posted 06 April 2013 - 06:20 AM
#2
Posted 06 April 2013 - 06:22 AM
rs.setOutput("side", i <1)
not sure what you want though
not sure what you want though
#3
Posted 06 April 2013 - 06:22 AM
No. Unless you're trying to use a function? What is the use case here, what are you actually trying to accomplish?
Edit:
This always sets the output, rather than only setting the output if i is less than one.
Edit:
PixelToast, on 06 April 2013 - 06:22 AM, said:
rs.setOutput("side", i <1)
not sure what you want though
not sure what you want though
This always sets the output, rather than only setting the output if i is less than one.
#4
Posted 06 April 2013 - 06:29 AM
You can use the ternary operator
local x = z==1 and 'its ture' or 'its false'
#6
Posted 06 April 2013 - 06:40 AM
nvm i figured it out while thinking of a way to explain. the code i want. very sorry about this. it was my stupid for forgetting how the code works.
#7
Posted 06 April 2013 - 06:41 AM
rs.setOutput( "side", i < 1 and true or false )
#9
Posted 06 April 2013 - 08:26 AM
Lol ternary operator... What do you mean it doesn't do anything? I thought just plain
EDIT:
Oh misunderstood lol, but setting it to false doesn't matter so rs.setOutput('side', i < 1) is fine really
rs.setOutput( 'back', i < 1 )would work but...
Lyqyd, on 06 April 2013 - 06:22 AM, said:
EDIT:
Oh misunderstood lol, but setting it to false doesn't matter so rs.setOutput('side', i < 1) is fine really
2 user(s) are reading this topic
0 members, 2 guests, 0 anonymous users











