lua-users home
lua-l archive

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


On 19.01.2010 03:49, Alexander Gladysh wrote:
> Hi, list!
> 
> I was asked to update wiki page on Lua 5.2 with the data I've gathered
> from the work releases and posted to this list previously.

Thanks, it's good to have it in one place.

Regarding this excerpt:

table.unpack() and table.pack()

unpack() is renamed to table.unpack(). table.pack() is added, packing
arguments to a table and storing number of arguments to table's field "n".

I wonder why table.pack() sets "n" in the newly created table? It
resembles old lua times. Wouldn't it be better (or more in 5.2 spirit)
to set something like:
setmetatable(newtable, {_len=function(t) return "n" end})
where n is the number of arguments packed? Then we could get #newtable
intstead of newtable.n (or am I missing something?)

Regards,
miko