Modules
Table
Shared

Shared

Adds additional functions alongside the standard table library and the ox lib table library (opens in a new tab).

core.table.length

Returns the length of a table

core.table.length(tbl)
  • tbl: table

Return:

  • length: number

core.table.find

Finds an element in a table based on a boolean function

core.table.find(tbl, cb)
  • tbl: T[]
    • T is a generic table element
  • cb: fun(element: T): boolean

Return:

  • value: T or nil
  • index: number or nil

core.table.filter

Filters a table based on a boolean function

core.table.filter(tbl, cb)
  • tbl: T[]
    • T is a generic table element
  • cb: fun(element: T): boolean

Return:

  • filteredTable: T[]

core.table.keys

Extracts the keys of a table into an array

core.table.keys(tbl)
  • tbl: table<K,V>

Return:

  • keys: K[]