lua-users home
lua-l archive

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


Hello,
        I ran into this problem with table.unpack. I am using Lua 5.3.5 and I see this:

Lua 5.3.5  Copyright (C) 1994-2018 Lua.org, PUC-Rio
> t1 = {nil,"test"}
> t2 = {true,nil,"test"}
> table.remove(t2,1)
true
> table.unpack(t1)
nil     test
> table.unpack(t2)
>

So specifically after removing the 1st element using table.remove the table.unpack does not return anything even though t1 and t2 have the same values.

Is this expected behavior? Are there any guidelines how to unpack an array with nil values?

Thanks,
Milind