Garry's Mod Wiki

table.Inherit

table table.Inherit( table target, table base )

Description

Copies any missing data from base to target, and sets the target's BaseClass member to the base table's pointer.

See table.Merge, which overrides existing values and doesn't add a BaseClass member.

See also table.Add, which simply adds values of one table to another.

Sub-tables aren't inherited. The target's table value will take priority.

Arguments

1 table target
Table to copy data to
2 table base
Table to copy data from

Returns

1 table
Target

Example

Example of how this function works.

local table1 = { "A", "Golden" } local table2 = { "Two", "Orange", "Apple" } table.Inherit( table1, table2 ) PrintTable( table1 )
Output: 1 = A 2 = Golden 3 = Apple BaseClass: 1 = Two 2 = Orange 3 = Apple

Page Links


Special Pages


Wikis

?

Render Time: 102ms

DB GetPage 77
Generate Html 6
SaveChanges (1) 10
Render Body 0
Render Sidebar 6