[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: copy a table
- From: Javier Guerra <javier@...>
- Date: Tue, 30 Jan 2007 08:37:22 -0500
On Tuesday 30 January 2007 8:18 am, Thomas Hafner wrote:
> This will do it:
>
> target = {unpack(source)}
unpack(t) only works with arrays, that is, a table with consecutive integer
keys without holes. (see the length operator (#) definition (ref manual,
2.5.5))
also, i guess there's a implementation limit to returned values... was it
about 4000 items?
a bit testing:
t={}
for i =1,1e6 do
table.insert (t, 1)
if #{unpack(t)} ~= i then print ("fail!", i) break end
if i % 10 == 0 then print (i) end
end
goes for a while, then fails with "stack overflow (table too big to unpack)",
when t reaches 2048 elements
--
Javier
Attachment:
pgp3XT336qHwu.pgp
Description: PGP signature