841 B
841 B
| id | name | category | kind | tokens | sig | tip | order | ns | member |
|---|---|---|---|---|---|---|---|---|---|
| list-push | List.push | list | namespace-method | List.push | List.push(s, v) -> void | Append an element to the end of a slice. | 1 | List | push |
Adds v to the end of s, growing the backing buffer if needed, so the slice's length increases by one. It is the same operation as the bare push(s, v). Because a slice is shared, the new element is visible to every holder. Use it to collect spawned entities, build a list of hits, or fill an inventory.
Parameters:
s— the slice to append tov— the element to add (matching the slice's element type)
program Collect {
state CollectState {
picked: []int = new []int
}
handler Grab(collect_st: CollectState) phase Update {
List.push(collect_st.picked, 7)
}
}