Variables: Lists
Lists are very important variable types, because many of RealFlow's scene elements are stored in lists, for example selected objects, all daemons or emitters, particles, and vertices.
- A list can contain a virtually infinite number of elements, but they are unsorted.
- RealFlow appends elements to a list in the order of appearance and each new list elements gets an unique index.
- List indices always start with 0.
- To go through the elements of a list, a → loop is required.
Basic Operations
The command to add an element to the end of a list (here: numbers) is: numbers.append(element)
In order to address a certain element you have to know its index. The notation is: listElement = numbers[index]
It is possible to check if a certain element is stored in the list with: if (element in numbers): do something
An empty list variable is initialized with: newList = []
To remove an element use: numbers.remove(element)
With this command it is possible to find out how many elements are inside the list: numberOfElements = len(numbers)