lua-users home
lua-l archive

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


On Wed, May 19, 2010 at 2:09 PM, Gavin Wraith <gavin@wra1th.plus.com> wrote:
> In message <c659dc1951.wra1th@wra1th.plus.com> you wrote:
>
>> I am still not sure what the definition is.
>
> Is the following a correct restatement of what #t means for a table t?
>
>  The length, #t, of a table t may take different values, but is
> guaranteed to be 0 if t[1] is nil and to be n if t[n+1] is nil
> and t[m] is not nil for all positive integers m less than n+1.

It is not guaranteed to be 0 if t[1] is nil:

 > print(#{nil, 1})
 2

-Duncan