function
push
push(slice, x)
Appends a value to the end of a slice, growing it by one element. Create the slice first with new []T, then push items onto it; afterward len reflects the new count and the element is reachable by index. Use it to build up lists at runtime — a queue of spawn requests, collected scores, parsed tokens — where you don't know the size in advance. The value's type must match the slice's element type.
Parameters
slicethe growable slice to append toxthe element to appendExample
program BuildWaveList {
handler PlanWaves phase Start {
let wave_sizes = new []int
push(wave_sizes, 4)
push(wave_sizes, 6)
for index in 0 .. len(wave_sizes) {
print(wave_sizes[index])
}
}
}