Tables
srb_lib comes with some tables useful functions.
Print Table 
--- Recursively print key/values of a table
---@param tbl table
---@param indent number
---@param done table
function SRB:PrintTable(tbl, indent, done)
Table Inherit 
--- Copies any missing data from base to tbl
---@param tbl table
---@param base table
---@return table
function SRB:table_Inherit(tbl, base)
Table Is Empty 
--- Returns whether a table has iterable items in it, useful for non-sequential tables
---@param tbl table
---@return bool
function SRB:table_isEmpty(tbl)
Table Has Value 
--- Returns whether the value is in given table
---@param tbl table
---@return bool
function SRB:table_hasValue(tbl, val)
Table Sort Desc 
--- Returns sort table descending
---@param tbl table
---@return table
function SRB:table_sortDesc(tbl)
Table Sort by Key 
--- Returns a table sorted numerically by Key value
---@param tbl table
---@param desc bool
---@return table
function SRB:table_sortByKey(tbl, desc)
Table Random 
--- Return a random key, value
---@param tbl table
---@return dynamic, dynamic
function SRB:table_random(tbl)
Table Shuffle 
--- Performs an inline Fisher-Yates shuffle on the table in O(n) time
---@param tbl table
function SRB:table_shuffle(tbl)
Table Key from Value 
--- Return a key from a table by a value
---@param tbl table
---@param val dynamic
---@return dynamic
function SRB:table_keyFromValue(tbl, val)
Table Add 
---
---@param dest table
---@param source table
---@return table
function SRB:table_add(dest, source)
Table Remove by Value 
--- Remove a key from a table by its value and return the removed key
---@param tbl table
---@param val dynamic
---@return dynamic
function SRB:table_removeByValue(tbl, val)
Table get Keys 
--- Return a table of keys of a table
---@param tbl table
---@return table
function SRB:table_getKeys(tbl)
Table clear Keys 
---
---@param tbl table
---@param saveKey bool
---@return table
function SRB:table_clearKeys(tbl, saveKey)
Table Collapse Key Value 
---
---@param tbl table
---@return table
function SRB:table_collapseKeyValue(tbl)
Table Copy 
---
---@param tbl table
---@param lookupTable table
---@return table
function SRB:table_copy(tbl, lookupTable)
Table Copy From 
---
---@param from table
---@param to table
function SRB:table_copyFromTo(from, to)
Table Count 
--- Count values from a table
---@param tbl table
---@return number
function SRB:table_count(tbl)
Table Empty 
--- Empty a table
---@param tab table
function SRB:table_empty(tbl)
Table Merge 
--- Merge a source table into a dest table and return the dest table
---@param dest table
---@param source table
---@param forceOverride bool
---@return table
function SRB:table_merge(dest, source, forceOverride)
Table Sorted Pairs 
---
---@param tbl table
---@param sortDesc bool
---@return function
function SRB:sortedPairs(tbl, sortDesc)
Last updated