[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Table functions in Lua 5.2 Reference Manual
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Tue, 26 Apr 2011 09:30:26 -0300
> 4. Is There really need for table.pack? As far as I understand, this
> both are equivalent:
>
> t = table.pack(...)
> t = {...}; t.n = #t
They not equivalent if the arguments to table.pack contain nils,
either in the middle or at the end. That's the whole purpose of t.n.
t = table.pack(1,nil,3,nil,nil)
print(t.n,#t)
prints 5 and 1.