Copy a Table and Make it its own independent object

Hi,

Can someone please help?

I have copied a table and would like to use the contents of the copied table as their own object. But when i do it refers back to the original object and modifies that. The contents of the tables were (display.newImage)'s (there were two of them). Can i copy the table and then have all four objects displayed at once. 

Thx 

You will need to make four unique display objects. You can’t table copy to make multiple versions.

Now for tables in general in Lua, when you do:

local table2 = table1

All you are doing is assigning the memory address of table1 to table2 (and some meta information like it being a table). You’re not making a unique copy of the table.  Look at this article on helping you understand how to do a deep copy:

http://lua-users.org/wiki/CopyTable

Rob

https://stackoverflow.com/questions/640642/how-do-you-copy-a-lua-table-by-value

You will need to make four unique display objects. You can’t table copy to make multiple versions.

Now for tables in general in Lua, when you do:

local table2 = table1

All you are doing is assigning the memory address of table1 to table2 (and some meta information like it being a table). You’re not making a unique copy of the table.  Look at this article on helping you understand how to do a deep copy:

http://lua-users.org/wiki/CopyTable

Rob

https://stackoverflow.com/questions/640642/how-do-you-copy-a-lua-table-by-value