lua-users home
lua-l archive

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


On May 19, 2010, at 12:33 PM, Tony Finch wrote:

> On Wed, 19 May 2010, Doug Currie wrote:
>> Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
>>> nil_t = {}
>>> t = {}
>>> setmetatable(t,{ __index = function () return nil_t end })
>>> return #t
>> 0
>>> return  t[1]
>> table: 0x100109640
>>> 
>> 
>> -- Note: t[n+1] is not nil!
> 
> Er, yes, that's kind of the point.

But that ignores my point: should the documentation say:

The length of a table t is defined to be any integer index n such that rawget(t,n) is not nil and rawget(t,n+1) is nil

rather than

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

?

e