< Functions | UserGuide | Lua Variables >


Operators

Conditions

A condition is an expression that is evaluated to a value which is then interpreted as true or false. In Lua, any value that is not nil or false is true. Conditional blocks are then executed if the condition is true:

if 5+5 == 10 then
  print("yes, 5+5 is 10")
end

We can use certain operators in order to generate true or false values. These operators are in lua

operatormeaningtrue expression
==equal5==5
~=not equal5~=6
<less5<6
>greater6>5
<=less or equal5<=5
>=greater or equal5>=5
ortrue if one of the values is truetrue or false
andtrue if both values are truetrue and 5
notinverts a valuenot false