lia.table

Various useful table related functions.

Functions

Filter(tab, callback)

Filters a table based on a callback function.

Parameters

  • tab Table

    The table to filter.

  • callback Function

    The function to call for each element; if it returns true, the element is kept.

Returns

  • any

    table The filtered table.

FullCopy(tab)

Creates a deep copy of a table.

Parameters

  • tab Table

    table The table to copy.

Returns

  • any

    table A deep copy of the table.

Lookupify(tbl)

Creates a lookup table from a list of values.

Parameters

  • tbl Table

    The list of values to create a lookup table from

Returns

  • any

    table A lookup table where the keys are the values from the input list

MakeAssociative(tab)

Converts a table into an associative table where the original values are keys.

Parameters

  • tab Table

    The table to convert.

Returns

  • any

    table The associative table.

Sum(tbl)

Sums all numerical values in a table.

Parameters

  • tbl Table

    The table containing numerical values to sum

Returns

  • any

    number The sum of all numerical values

Unique(tab)

Returns a table of unique values from the input table.

Parameters

  • tab Table

    The table to process.

Returns

  • any

    table The table of unique values.