Relational Operators
The relational operators in nzLua are
== ~= < > <= >= !=
These relational operators always result in false or true.
Equality (==
) first compares the type of its operands. If the types are different, then the result is false. Otherwise, the values of the operands are compared. Numbers and strings are compared in the usual way. Objects (tables, userdata, and functions) are compared by reference: two objects are considered equal only if they are the same object. Every time you create a new object (a table, userdata, thread, or function), this new object is different from any previously existing object.
The conversion rules of Coercion do not apply to equality comparisons. Thus, "0"==0
evaluates to false, and t[0]
and t["0"]
denote different entries in a table.
The operators ~= and != are exactly the negation of equality (==). Operator <> is not supported on Db2® Warehouse and Integrated Analytics System.
The order in which relational operators work is as follows:
- If both arguments are numbers, they are compared as such.
- If both arguments are strings, their values are compared according to the current locale.