lua-users home
lua-l archive

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


On Wed, Jun 10, 2015 at 10:23 AM, Brigham Toskin
<brighamtoskin@gmail.com> wrote:
> On Tue, Jun 9, 2015 at 11:29 PM, Tim Hill <drtimhill@gmail.com> wrote:
>>
>> It’s late and i’m typing from memory .. but didn’t ipairs() finally settle
>> down to just stopping at the first nil (in 5.3 that is)?
>
>
> Yep.
>
> Lua 5.3.0  Copyright (C) 1994-2015 Lua.org, PUC-Rio
>> = #{1, nil, 3, 4}
> 4
>> for i,v in ipairs{1, nil, 3, 4} do print(i, v) end
> 1 1

Unless the table has a __len metamethod, at which point it uses that instead.

/s/ Adam