dcsex.table
Table - extensions to lua tables.
Contents
Functions
_t.iterators.hasFunc(tbl, iterator, func)
Parameters
- tbl
- the table of objects whos keys do not matter and whos values are the objects to be checked if the object implements the optional
func
function. - iterator
- callback to iterate over tbl, used in for loop.
- func
- the name of the function to check for and execute if exists.
_t.iterators.sortedPairs(tbl, order)
Parameters
- tbl
- The table to iterate over
- order
- optional function to sort tbl keys with
Returns
- an iterator to be used in the generic for loop
_t.contains(tbl, val)
Parameters
- tbl
- table to search
- val
- value to look for
Returns
- True if table contains val, false otherwise
_t.deepCopy(obj)
This is an expensive operation.
Parameters
- obj
- the object to copy
Returns
- A deep copy of obj
_t.dump(tbl)
Parameters
- tbl
- A table
Returns
- A string representaton of the table
_t.foreachCall(tbl, iterator, func)
Parameters
- tbl
- the table of objects whos keys do not matter and whos values are the objects to be checked if the object implements the optional
func
function. - iterator
- callback to iterate over tbl, used in for loop.
- func
- the name of the function to check for and execute if exists.
_t.foreachProtectedCall(tbl, iterator, func, logger)
Parameters
- tbl
- the table of objects whos keys do not matter and whos values are the objects to be checked if the object implements the optional
func
function. - iterator
- callback to iterate over tbl, used in for loop.
- func
- the name of the function to check for and execute if exists.
- logger
- to report errors.
_t.getKey(tbl, val)
If val not found return nil.
Parameters
- tbl
- the table to search
- val
- the value to find
Returns
- The key associated with val in the table or nil
_t.getKeys(tbl)
Parameters
- tbl
- the table to pull keys from
Returns
- array of keys from tbl
_t.merge(dest, source)
Note the values in source are not deep copied.
Parameters
- dest
- the table keys/values from source will be saved to
- source
- table of key/values to copy
Returns
- a table of merged keys/values
_t.shallowCopy(obj)
Parameters
- obj
- the object to clone
Returns
- a new table that is a copy of obj