[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
**Subject**: **Re: Possible bug relating to table sizes**
**From**: Dirk Laurie <dirk.laurie@...>
**Date**: Sat, 29 Oct 2011 15:16:11 +0200

2011/10/29 Axel Kittenberger <axkibe@gmail.com>:
> # is not biuniquely defined for non linear tables that do not go from
> 1...n. You can read up the exact definition of #, but usually just
> don't do it for something that is not defined 1..n.
>
…
> The length of a table t is defined to be any integer index n such that
> t[n] is not nil and t[n+1] is nil; moreover, if t[1] is nil, n can be
> zero.
Lua 5.2 beta pitches it more strongly: # is _undefined_ for tables
that do not go from 1...n, unless you have defined a __len metamethod.
So that last sentence is no longer valid.
Dirk