lua-users home
lua-l archive

Re: copy a table

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


Javier Guerra wrote:
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?
Thanks for giving the limits.
I think we can say it is a nice trick if used by knowing these limits, ie. with a precise subset of possible tables, within a given project. :-)
--
Philippe Lhoste
-- (near) Paris -- France
-- http://Phi.Lho.free.fr
-- -- -- -- -- -- -- -- -- -- -- -- -- --

AltStyle によって変換されたページ (->オリジナル) /