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

MemberDescriptionAvailable through
filterLazily retains the remaining items accepted by a predicate.
mapLazily transforms every remaining item from this cursor.
nextAdvances this cursor and returns either its next Item or End.