SplitScript reference / Iterator
Iterator
capability
capability Iterator
Produces a sequence of values one step at a time.
Its associated item type is the value yielded by Iterator.next. Exhaustion is represented by the End step, not by None, so iterating a sequence of optional values preserves an actual None item.
Examples
Advance an iterator cursor
state "game.exe" {}
onAttach {
let iterator = [1, 2].iterator()
let step = iterator.next()
}
Methods
| Member | Description | Available through |
|---|---|---|
| filter | Lazily retains the remaining items accepted by a predicate. | |
| map | Lazily transforms every remaining item from this cursor. | |
| next | Advances this cursor and returns either its next Item or End. |