lua-users home
lua-l archive

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


Hi,

> 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?

Bye,
Wim