|
|
||
|
Are there any tricks to insert all the keys and values of one table into another?
function dup(tab)
local res = {}
if type(tab) ~= "table" then return tab end
for k, v in tab do res[dup(k)] = dup(v) end
return res
end
And it's kind of safe too :)
Eh... kind-of-safe as in "only returns with a stack overflow" from:
a = {}
a.b = a
dup(a)
you mean? [;-)]
Ashwin.
--
no signature is a signature.