List Module
The list module provides helpers for ordered tables and collections.
List Operations
Section titled “List Operations”| Function | Arguments | Description |
|---|---|---|
list.insert(t, val) | table, any | Adds a new element to the end of a list. |
list.remove(t, i) | table, any | Removes an element by index or key. |
list.clear(t) | table | Empties all keys and values from the list. |
list.find(t, val) | table, any | Returns the index or key of the specified value. |
list.check(t) | table | Validates 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)endOUTPUT:
[1] Carrot
[2] Potato
[3] Wheat