GetListElement (<-list I) ->element
Returns the value at the specified index of a list. Lists are indexed from zero.
Note: If a list is stored in a variable, this can be abbreviated to <-list[<-index].
Split("1,2,3,4,5,6" ",") ->list 6 0 do Trace (<-list I GetListElement) #functionally equivalent Trace (<-list[I]) #functionally equivalent loop
# A 2-line code that gets a random element from a provided list. RandInt(0 GetListCount(<-units)) ->randIndex GetListElement(<-units <-randIndex) ->targetUnit
# A function for selecting a random element from a list: 1 2 4 8 16 list ->list <-list @selectRandomElement ->randElement :selectRandomElement Dup Getlistcount 0 swap RandInt Getlistelement
⇐ Index