lua-users home
lua-l archive

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


> Lua manual defines length operator "#" for tables as follows:
> [...]
>
> As one can see from the definition above tbl[#tbl+1] must always be nil.
>
> Unfortunately, it is not the case when table has a metatable as the
> following example illustrates:
>
> [...]
>
> Of course, I can always redefine __len meta-method to bring some
> sanity to the table.  What worries me, though, is that the default
> behavior is so messy.

Probably the manual should mention that all operations in the
explanation refer to the raw operations, but most people somehow seem to
understand that.


> Am I missing something?

Goodwill?

-- Roberto