[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: lists with nil play nice for Lua 5.2
- From: "Jerome Vuarand" <jerome.vuarand@...>
- Date: Mon, 30 Jul 2007 11:19:48 -0400
Patrick Donnelly wrote:
> > In that context the # operator is not well defined. I see two good
> > (though not perfect) solutions: either make the table # operator
> > deterministic (for example return the biggest integer key), or allow
> > users to override the # operator (that's my prefered solution, since
it
> > would be useful for other problems, like returning the norm of a
> > vector).
>
> http://www.lua.org/manual/5.1/manual.html#2.8
>
> __len??
I thought so initially, but it's not overridable for tables :-)