Garry's Mod Wiki

table.CopyFromTo

  table.CopyFromTo( table source, table target )

Description

Empties the target table, and merges all values from the source table into it.

Arguments

1 table source
The table to copy from.
2 table target
The table to write to.

Example

Demonstrates the use of this function.

local Test1 = {A = "String keys", B = "Table 1"} local Test2 = {"Numeric keys", "Table 2"} table.CopyFromTo( Test2, Test1 ) PrintTable( Test1 )
Output:
1 = Numeric keys 2 = Table 2