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.
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:
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: