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 copy of the original table.

Description​

Recursively copy the entire table; all values except functions and userdata are copied.
Cyclic references in the source table are preserved in the copy.

Example​

local _g = table.deep_copy(_G)