[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: metamethod __lt oddity?
- From: "Wim Couwenberg" <w.couwenberg@...>
- Date: Fri, 17 Jan 2003 14:41:28 +0100
> The error I get is "lua: metamethods.lua:27: attempt to compare table
> with number". From the documentation it would seem that this should
> work, just as t+4 does. Or am I missing something?
Lua 5 will report this error if the operands don't have the same type. This
behavior is different from the + operator. I don't know the reason behind
this. It does look odd that such constructions (e.g. comparing table-based
custom "types" with non-table data) don't seem possible.
Does anyone know why it was implemented like this?