lua-users home
lua-l archive

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


Hi,

Lisa Parratt wrote:
> Vague bells are telling me that it's related to passing varargs where 
> one the the arguments is nil - it might require the old varargs support 
> to be enabled - I'll have a better look later.

The semantics of the Lua 5.1 table 'size' aka table.getn(t)
aka lua_objsize() aka #t aka luaH_getn(L, t) are undefined
if there are intervening nils. Only 'compact' tables are
supported.

I.e. #{...} (5.1 style) may be less than table.getn(arg)
(5.0 style).

table.getn(t) no longer looks at t.n or REGISTRY.LUA_SIZES.
In fact the latter is completely gone unless you define
LUA_COMPAT_GETN. Defining this is not recommended due to the
resulting inconsistency between #t and table.getn(t) and other
problems with the old sizes table (it doesn't ever shrink).

BTW: The 5.1 way of handling table sizes is a lot faster
and saves space, too.

Bye,
     Mike