[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: pack/unpack
- From: Alexandre Rion <gaumerie@...>
- Date: Wed, 15 Jun 2011 15:09:20 +0200
Yes it is, in the same way as:
function f1()
return 1,2,3
end
function f2()
return 4,5,6
end
print(f1(),f2())
1,4,5,6
Alexandre
-----Message d'origine-----
From: Fredrik Widlund
Sent: Wednesday, June 15, 2011 2:57 PM
To: Lua mailing list
Subject: pack/unpack
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