Table.clone

From GiderosMobile
Revision as of 02:19, 10 May 2026 by MoKaLux (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Available since: Gideros 2022.3
Class: table

Description

Duplicates a table.

(table) = table.clone(source)

Returns a copy of the input table (source) that has the same metatable, same keys and values, and is not frozen even if source table was. The copy is shallow: implementing a deep recursive copy automatically is challenging, and often only certain keys need to be cloned recursively which can be done after the initial clone by modifying the resulting table.

Parameters

source: (table) the source table to clone

Return values

Returns (table) the new cloned table

Example

local table2 = table.clone(table1)