lua-users home
lua-l archive

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


Hi,

Could someone explain if the following is by design:
Lua 5.1.4  Copyright (C) 1994-2008 Lua.org, PUC-Rio
> a={1,2,3}
> b={4,5,6}
> c={unpack(a), unpack(b)}
> print(table.concat(c, ","))
1,4,5,6

It seems the second unpack starts "writing" its members to position i+1 and thus overwrites the members of the first unpack? Is this really correct behaviour?

Of course:
> c={unpack(a)}
> print(table.concat(c, ","))
1,2,3

Kind regards,
Fredrik Widlund