lua-users home
lua-l archive

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



On 15 Jun 2011, at 09:57, Fredrik Widlund wrote:
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

Check the 'vararg' package [1], which allows you to do thinks like:

require "vararg"
a=vararg.pack(1,2,3)
b=vararg.pack(4,5,6)
c={vararg.concat(a,b)}
print(table.concat(c, ","))

[1] http://luarocks.org/repositories/rocks/#vararg

--
Renato Maia
Computer Scientist
Tecgraf/PUC-Rio
__________________________
http://www.inf.puc-rio.br/~maia/