Skip to content

List Module

The list module provides helpers for ordered tables and collections.


FunctionArgumentsDescription
list.insert(t, val)table, anyAdds a new element to the end of a list.
list.remove(t, i)table, anyRemoves an element by index or key.
list.clear(t)tableEmpties all keys and values from the list.
list.find(t, val)table, anyReturns the index or key of the specified value.
list.check(t)tableValidates whether the object is a LAU list.
list.sort(t, f?)table, func?Sorts the list numerically or with a custom function.
lau-compiler.exe
varol crops = {"Wheat", "Potato", "Carrot"}
list.sort(crops)
for i, name inpairs(crops) do
print("[" + i + "] " + name)
end
OUTPUT:
[1] Carrot [2] Potato [3] Wheat