Lua Programming/How to Lua/comparative operator
The lua programming language provides a set of comparative operators. The comparative operators are used to determine equality or inequality or otherwise make comparisons of numeric or string values, and produce a boolean truth based on the result. In lua, all values are true, except nil and false.
| Operator | Description |
|---|---|
| == | equality |
| ~= | inequality |
| < | lessthan |
| > | greaterthan |
| <= | less than or equal to |
| >= | greater than or equal to |
Coercion does not take place for comparative operators
print ("9" > 8) -- coercion does not take place for comparative operators
Last modified on 9 March 2011, at 20:57