Garry's Mod Wiki

Revision Difference

table.Add#511925

<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>.⤶ </description>⤶ <realm>Shared and Menu</realm>⤶ <file line="104">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>