LifeLua 21-08-2025
Documentation for LifeLua, a Lua interpreter for the PS Vita
Loading...
Searching...
No Matches
table

Extra table functions (extends Lua's table library) More...

Detailed Description

These are added to Lua's standard table library and work on lists (tables with keys 1, 2, 3, ...). Note that the value comes first and the list second.

Functions

boolean table.find (any value, table list)
 
any table.removefirst (any value, table list)
 

Function Documentation

◆ table.find()

boolean table.find ( any value,
table list )

Checks if a value is in a list

Parameters
valueThe value to look for
listThe list to search
Returns
true if the value is in the list
Example:
local fruits = {"apple", "banana"}
print(table.find("banana", fruits)) -- true

◆ table.removefirst()

any table.removefirst ( any value,
table list )

Removes the first time a value appears in a list (the items after it move down by one)

Parameters
valueThe value to remove
listThe list to remove it from
Returns
The removed value, or nothing if it wasn't found
Example:
local items = {"a", "b", "a"}
table.removefirst("a", items) -- items = {"b", "a"}