Garry's Mod Wiki

table.Add

  table table.Add( table target, table source )

Description

Adds all values from source table into the target table. This is most useful for sequential tables, not "dictionary" or "map" tables. See table.Merge if you want to merge 2 tables into one.

See table.insert for a function that adds a single value, and table.Inherit for a function that inherits keys from one table to another.

Arguments

1 table target
The table to insert the new values into.
2 table source
The table to retrieve the values from.

Returns

1 table
The target table.

Example

Demonstrates the use of this function. Note that duplicate values will be added.

local Test1 = {"One","Two","Three", "Four"} local Test2 = {"Four", "Five", "Six"} table.Add( Test1, Test2 ) print( table.concat(Test1, " ") )
Output:
One Two Three Four Four Five Six