lua-users home
lua-l archive

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

2010/1/9 Patrick Donnelly <>:
> On Fri, Jan 8, 2010 at 1:49 PM, Luiz Henrique de Figueiredo
> <> wrote:
>> Lua 5.2.0 (work1) is now available at
>> MD5     a066dd9186d88389ed61b9e6369e2c3e  -
>> SHA1    4d428019ff72bf5a72e99240acb5f98dc532fa7b  -
>> This is a work version. All details may change in the final version.
>> Besides the changes in the code, the documentation in the tarball has been
>> simplified and the old READMEs and INSTALL have been moved to doc/readme.html.
>> The reference manual has been updated.
>> All feedback welcome. Thanks.
> I liked the idea of table.pack but am baffled by what it does. I had
> assumed we would be able to "reset" the array portion of a table to
> some new list. (Effectively, have Lua reset the array portion to the
> number of args and set each index just like we do in the table
> constructor.) This table.pack does not seem at all useful. :(

It's the opposite of unpack(). If you have, say... a function that
returns multiple values or a vararg ... then you can't safely use
{...} and know how many items were returned (in case of some being
nil). table.pack helps by setting n equal to the number of items (such
that t.n might not equal #t).