|
Am 22.09.2013 14:10 schröbte Jayanth Acharya:_________________________________________
So, if I understand this correctly, I cannot use the < and <= operators in
Lua code while comparing 2 tables say 'a' and 'b', where the intent was to
check (a < b). However I could rewrite the Lua code as (b > a). Right ?
If so, then this is semantically correct, but makes the code less readable,
no ?
| you have | you write | Lua uses |
|-------------|-----------|--------------|
| __lt only | a < b | a < b |
| __lt only | a <= b | not (b < a) |
| __lt only | a > b | b < a |
| __lt only | a >= b | not (a < b) |
| __lt + __le | a < b | a < b |
| __lt + __le | a <= b | a <= b |
| __lt + __le | a > b | b < a |
| __lt + __le | a >= b | b <= a |
| __le only | a < b | #error# |
| __le only | a <= b | a <= b |
| __le only | a > b | #error# |
| __le only | a >= b | b <= a |
------------------------------------------
HTH,
Philipp