copy = CopyTable(t)
Option |
Description |
t |
An existing table. |
copy |
A copy of the table. |
Tables cannot be copied by assignment using the equal sign, otherwise they will remain linked; changing individual elements in one will change the same elements in the other (they share the same memory). Instead, the above utility function must be used to copy tables.
See the topics Passing Arguments and Multiple Returns for further implications of this for passing/returning tables to and from a function.