July 2018
Beginner
202 pages
5h 42m
English
There are three meta methods used to compare objects for equality. For these meta methods to work, both tables must have the same comparison meta method! Each of these meta methods takes two arguments, the tables being compared:
The __eq meta method checks equality; for example, the expression table1 == table2 is actually evaluated as getmetatable(table1).__eq(table1, table2). But, this _eq meta method is also used to check for inequality. The expression table1 ~= table2 is evaluated as not (a == b), which can be expanded into ...