Lists
In Lua, these structures are called “tables”. These structures hold multiple data associated with a numeric index.
let emptyList = list<text>[] // empty list initializationlet fruits = ["banana", "kiwi", "apple", "pear", "cherry"]
Pewpew:Print(fruits[2]) // -> kiwi
To get the length of the list, or use #
prefix.
let fruits = ["banana", "kiwi", "apple", "pear", "cherry"]
repeat #fruits with i { Pewpew:Print(fruits[i])}
Adding elements to the list
Section titled “Adding elements to the list”Using hybroid’s Table
library:
let fruits = list<text>[]Table:Insert(fruits, "watermelon")
Pewpew:Print(ToString(fruits)) // -> ["watermelon"]