Lua Basics: table duplication?
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Lua Basics: table duplication?
- From: William Trenker <wtrenker@...>
- Date: 2005年8月28日 17:50:58 -0400
Sometimes I want to make a duplicate copy of a table, not just assign
another reference to it. Is this the standard way:
a={1,2,3, m="m", "n" , o={4}, p = function() end}
b={}
table.foreach(a, function(k,v) b[k]=v end)
Now I can remove elements from b without effecting a.
Thanks,
Bill