lua-users home
lua-l archive

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


> Yes, n is problematic because it isn't going to work with idioms like
> t[ #t + 1 ] = x.

That is the reason why 'table.pack' does not return the length as a
metamethod's result and why 'pack' (now 'table.pack') does not use
'n' automatically when available.

The explicit use of 'n' (as in "table,unpack(t, 1, t.n)") should remind
the programmer of what is going on.

-- Roberto