is their a conditional operator in lua just like java?
Conditional operator in lua
Started by ETHANATOR360, Nov 22 2012 09:41 AM
5 replies to this topic
#1
Posted 22 November 2012 - 09:41 AM
#2
Posted 22 November 2012 - 09:44 AM
If you mean comparisons in ifs:
However if you mean something like
== | is equal to > | is greater than < | is less than >= | is greater than or equal to <= | is less than or equal to ~= | is not equal to
However if you mean something like
var = (condition) ? onTrue : onFalse;then in lua, it's
var = condition and onTrue or onFalse
#3
Posted 22 November 2012 - 09:46 AM
Just to add; I don't believe there is:
x++ x+=y x-- x-=y
#4
Posted 22 November 2012 - 12:17 PM
i mean like x = y ? 1 : 0
#6
Posted 22 November 2012 - 12:41 PM
ETHANATOR360, on 22 November 2012 - 12:17 PM, said:
i mean like x = y ? 1 : 0
That's called the ternary operator.
http://codepad.org/CEtRWl6l
Kingdaro also showed you this.
EDIT: Isn't this shit supposed to alert me when someone posts something new? First the staff and recent thread frames are broken, now this.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











