(List Variables example with 3 elements)
Items can be inserted and removed at any position. They are very useful when you want to stack a bunch of game objects (or any supported data) and do something with them, without having to worry about how many elements you have stored.
There are multiple ways of accessing and storing data in List Variables and it's a bit more abstract than with Global or Local Variables.
A List Variables can be visualized as a list of items placed one after the other. Each element can be accessed via its index value, starting from 0 and increasing in one unit for each subsequent element.
(Concept of List Variables indexed from left to right)
Game Creator allows accessing the contents of a List Variable through the use of the following shortcuts:
Accesses an element via its index. If the index is negative or overshoots the number of elements in the list, it will return null.
Accesses the first element in the List Variables. If there are no elements, it will return null.
Accesses the last element of the List Variables. If there are no elements, it will return null.
Accesses a random element of the List Variables. If there are no elements, it will return null.
Accesses the previous value of the iterator. If the iterator is the first element, the previous element will be the last one. if there are no elements, it will return null.
Accesses the next value of the iterator. If the iterator is the last element, the next value will return the first element. If there are no values, it will return null.
Storing information in List Variables work very similarly as accessing its content. The only difference is that there's a value that is going to be added.
The iterator is an advanced feature of List Variables. It's an internal index that is updated every time the List Variable is accessed or modified.
So it basically remembers the last accessed or modified element. This is very useful when iterating over elements. You can access the First element and subsequently ask for the Next element, allowing you to iterate all elements of the List Variable.