Skip to content

NamedTupleList

Inherits: Class

Methods

GetNumRows

lua
function NamedTupleList:GetNumRows()
  -> number

Gets the number of rows in the list.

Returns:

TypeDescription
number

GetRow

lua
function NamedTupleList:GetRow(rowIndex)
  -> ...any

Gets the data for a given row.

Parameters:

NameTypeDescription
rowIndexnumberThe row index

Returns:

TypeDescription
...any

GetRowField

lua
function NamedTupleList:GetRowField(rowIndex, fieldName)
  -> any

Gets a single field for a given row.

Parameters:

NameTypeDescription
rowIndexnumberThe row index
fieldNamestringThe name of the field

Returns:

TypeDescription
any

InsertRow

lua
function NamedTupleList:InsertRow(...)
  -> number

Insert a row into the list and returns its index.

Parameters:

NameTypeDescription
...anyThe row values

Returns:

TypeDescription
number

Iterator

lua
function NamedTupleList:Iterator()
  -> fun():number, ...any, table, number

Iterates over each row in the list.

Returns:

TypeDescription
fun():number, ...anyIterator with fields: rowIndex, ...
table
number

RemoveRow

lua
function NamedTupleList:RemoveRow(rowIndex)

Removes a row at a given index. NOTE: This will invalidate other row indexes.

Parameters:

NameTypeDescription
rowIndexnumberThe row index

SetRowField

lua
function NamedTupleList:SetRowField(rowIndex, fieldName, value)

Sets a single field for a given row.

Parameters:

NameTypeDescription
rowIndexnumberThe row index
fieldNamestringThe name of the field
valueanyThe field value

Wipe

lua
function NamedTupleList:Wipe()

Wipes the list.

Functions

New

lua
function NamedTupleList.New(...)
  -> NamedTupleList

Creates a new named tuple list.

Parameters:

NameTypeDescription
...stringThe tuple field names, in order

Returns:

TypeDescription
NamedTupleList