lua-users home
lua-l archive

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


Hi,

> >From the Lua documentation: "The number n of returned values is either
> the value of Table.n, if it is a number, or one less the index of the
> first absent (nil) value."
> 
> Any tips and ideas to solve this problem are welcome.

Just use the "n" member, like in:

local a = {[1]="aap", [3]="noot", n=3}

local b, c, d = unpack(a)

print(tostring(b), tostring(c), tostring(d))

So insert a "Table.n = <number>" just before your unpack call.

Bye,
Wim