lua-users home
lua-l archive

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


>>> it
>>> would be convenient (and consistent) if the # operator 
>>> provided the following behaviour (this is the assertion):
>>> 
>>> "# provides the same number as the number of iterations 
>>> provided by ipairs".

CW>> Convenient maybe, but also more expensive.  The current # implementation
CW>> is O(log(N)) where N is the number of entries in the array part.  The

> plus, it would change the semantics of the # operator such that the
> expression t[#t+1]==nil would not necessarily be true any more.

That would still be true.  (ipairs stops at the first nil value.)

--
Wim