Skip to main content

Deep copy a table (table.deep_copy)

Declaration

copied = table.deep_copy(t)

Parameters

  • t
    Table. The table to copy.

Returns

  • copied
    Table. A deep-copied table.

Notes

Iteratively copy a table into a new table; all values except functions and userdata are copied.
If there are cyclic references in the original table, the relationship is preserved in the copy.

Example

local _g = table.deep_copy(_G)