Skip to content

Lists

In Lua, these structures are called “tables”. These structures hold multiple data associated with a numeric index.

let emptyList = list<text>[] // empty list initialization
let 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])
}

Using hybroid’s Table library:

let fruits = list<text>[]
Table:Insert(fruits, "watermelon")
Pewpew:Print(ToString(fruits)) // -> ["watermelon"]