lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


In my heavily hacked personal copy of Lua which I use for experimentation, I go one further: If either operand regardless of type has an .__eq metamethod, a==b returns the result of the appropriate metamethod even if rawequal(a,b) returns true, thus allowing such atrocities as 7==Complex:new(7,0) to return true and a==a (where a is a usertype with a nan-like value) to return false. I'm now working on the C code to have a>b call a's .__lt metamethod if both operands define metamethods, and to have a<=b in the absense of .__le metamethods but the presence of .__lt metamethods be evaluated as (a==b) or (a<b) rather than the current not (b<a).

The above is strictly for fun and contains no serious proposals, but I have used my hacked copy to experiment with changes suggested on the list.

-- Mike Nelson