Garry's Mod Wiki

Revision Difference

table.Add#527473

<ambig page="table.insert">You might be looking for the "table.insert" function, which is used for inserting values into the table.</ambig>⤶ <function name="Add" parent="table" type="libraryfunc"> <description> Adds the contents from one table into another. The target table will be modified. See also <page>table.Inherit</page> and <page>table.Merge</page>. See also <page>table.insert</page>, <page>table.Inherit</page> and <page>table.Merge</page>. </description> <realm>Shared and Menu</realm> <file line="112">lua/includes/extensions/table.lua</file> <args> <arg name="target" type="table">The table to insert the new values into.</arg> <arg name="source" type="table">The table to retrieve the values from.</arg> </args> <rets> <ret name="" type="table">The target table.</ret> </rets> </function> <example> <description>Demonstrates the use of this function. Note that duplicate values will be added.</description> <code> local Test1 = {"One","Two","Three", "Four"} local Test2 = {"Four", "Five", "Six"} table.Add( Test1, Test2 ) print( table.concat(Test1, " ") ) </code> <output>One Two Three Four Four Five Six</output> </example>