githubEdit

Table

Noir.Libraries.Table: NoirLibrary

A library containing helper methods relating to tables.


Noir.Libraries.Table:Length(tbl)

Returns the length of the provided table.

Parameters

  • tbl: table

Returns

  • integer


Noir.Libraries.Table:Random(tbl)

Returns a random value in the provided table.

Parameters

  • tbl: table

Returns

  • any


Return the keys of the provided table.

Parameters

  • tbl: table

Returns

  • tbl


Return the values of the provided table.

Parameters

  • tbl: tbl

Returns

  • tbl


Get a portion of a table between two points.

Parameters

  • tbl: tbl

  • start: number|nil

  • finish: number|nil

Returns

  • tbl


Converts a table to a string by iterating deep through the table.

Parameters

  • tbl: table

  • indent: integer|nil

  • _journey: table<table, boolean>|nil

Returns

  • string


Copy a table (shallow).

Parameters

  • tbl: tbl

Returns

  • tbl


Copy a table (deep).

Parameters

  • tbl: tbl

  • _journey: table|nil

Returns

  • tbl


Merge two tables together (unforced).

Parameters

  • tbl: table

  • other: table

Returns

  • table


Merge two tables together (forced).

Parameters

  • tbl: table

  • other: table

Returns

  • table


Find a value in a table. Returns the index, or nil if not found.

Parameters

  • tbl: table

  • value: any

Returns

  • any|nil


Find a value in a table. Unlike :Find(), this method will recursively search through nested tables to find the value.

Parameters

  • tbl: table

  • value: any

Returns

  • any|nil,: table|nil


Calls the function for every value in a table, and returns a new table with the results. local myTbl = {1, 2, 3}

Parameters

  • tbl: table

  • callback: fun(index: - any, value: any): any

Returns

  • table


Calls the function for every value in the provided table, keeping the value in a new table if the function returns true.

Parameters

  • tbl: table

  • callback: fun(index: - any, value: any): boolean

Returns

  • table


Calls the function for every value in the provided table, keeping the value in a new table if the function returns false. Unlike :Filter(), the indices are not maintained and table.insert is used instead.

Parameters

  • tbl: table

  • callback: fun(index: - any, value: any): boolean

Returns

  • table

Last updated