Table
Accessed via table
The table module provides functions for working with tables in TruScript.
Functions
Returns the number of entries in the table. When a function is given, it returns the number of entries for which function(value, key) is truthy.
Returns true if the table contains the specified key, and false otherwise.
Returns true if any entry in the table has the specified value, and false otherwise.
Returns an array containing the keys of the table.
Returns an array containing the values of the table.
Removes the entry with the specified key from the table, if present.
Removes all entries from the table.
Returns a new table with the same keys, where each value is the result of calling function(value, key) on the original entry.
Returns a new table containing only the entries for which function(value, key) returns a truthy value.
Combines the table's entries into a single value. Starting from the seed, the accumulator is updated by calling function(accumulator, value, key) for each entry, and the final accumulator is returned.
Returns the first value for which function(value, key) returns a truthy value, or nil if no entry matches.
Calls function(value, key) for each entry in the table.
Returns true if function(value, key) returns a truthy value for at least one entry, and false otherwise.
Returns true if function(value, key) returns a truthy value for every entry, and false otherwise. Returns true for an empty table.