lua-users home
lua-l archive

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


> 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.