Difference between revisions of "Table Addon"
From SolarStrike wiki
m (Protected "Table Addon" ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))) |
m |
||
Line 1: | Line 1: | ||
− | == copy | + | == copy == |
'''table table.copy(table tab)''' | '''table table.copy(table tab)''' | ||
Line 5: | Line 5: | ||
− | == find | + | == find == |
'''table table.find(table haystack, number|string needle)''' | '''table table.find(table haystack, number|string needle)''' | ||
Line 12: | Line 12: | ||
− | == print | + | == print == |
'''table.print(table tab[, number depth])''' | '''table.print(table tab[, number depth])''' | ||
Recursively dump the table to the standard output. This is useful for debugging. | Recursively dump the table to the standard output. This is useful for debugging. | ||
When called from Lua, you probably shouldn't include the depth... | When called from Lua, you probably shouldn't include the depth... |
Revision as of 03:50, 18 February 2015
copy
table table.copy(table tab)
Actually does a full copy of a table, instead of referencing the original. This also recursively copies sub-tables.
find
table table.find(table haystack, number|string needle)
Checks table 'haystack' for anything that matches 'needle'. If found, returns the table's key that contains the value. If no match is found, returns nil.
table.print(table tab[, number depth])
Recursively dump the table to the standard output. This is useful for debugging. When called from Lua, you probably shouldn't include the depth...