Tables {#lua_tables}
Table Manipulation
The following methods have been added to the built-in Lua table library.
table.concat
table.concat(tbl1, tbl2) - Merges the contents of one table into another. - Parameters: - tbl1: The table receiving the new content. - tbl2: The table containing the content to be copied.
table.contains
table.contains(table, o)
- Checks if a table contains a value.
- Parameters:
- table: Table to be checked.
- o: The object to check for.
- Returns: true
if o
is in table
.
table.clean
table.clean(tbl)
- Removes nil
values from a table.
- Parameters:
- tbl: The table to be cleaned.
- Returns: Copy of tbl
with nil
values removed.
table.join
table.join(table, delim)
- Joins a table of strings into a string.
- Parameters:
- table: Table to be joined.
- delim: (string
) Character(s) to be used as separator.
- Returns: (string
) The resulting string.