|
On Sun, Sep 22, 2013 at 5:29 PM, liam mail <liam.list@googlemail.com> wrote:
On 22 September 2013 12:47, Jayanth Acharya <jayachar88@gmail.com> wrote:
In the list of published metamethods available in every document that I read, I seem to be unable to find __gt and __ge anywhere. Are those really no present, or am I missing something (like checking the right place, doc) ?
If those are really absent, then does it mean we cannot use metatables to support the > and >= operators for say table comparison ?See [1] and the notes after each of the "le" and "lt" operators, the operators you mention come for free when you define other operators.Thanks Liam. Probably 5 minutes after posting that question, I found a mail written by Peter Hill way back 2004, asking this question, and also the answer, but I had completely missed the note in the manual.
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 ?