table.Copy

From GMod Wiki

Revision as of 01:08, 24 August 2011 by mrflippy (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Function
Syntax table.Copy( Table source table )
Where is this used?
Description:
Duplicates a table.
Returns: Table copied table
Part of Library: Table
Realm: NewerShared.png
BBCode Link: [b][url=http://wiki.garrysmod.com/?title=Table.Copy]Table.Copy [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]



Example

DescriptionCopy a table and print their contents.
Used onNewerShared.png
Code
 
test_table = {"this","that","and the other"} // Define the table.
test_table2 = table.Copy(test_table)
print(table.concat(test_table,", ")) // Prints "this, that, and the other" to the console.
print(table.concat(test_table2,", ")) // Same as above, as the table is identical.
 
OutputPrints the contents of an original table and a clone table.


Additional Notes

Tables are copied recursively

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox