Skip to main content

Variables

Declaration​


Variables can be declared in one of three ways.

Graph variables​

Graph variables can be declared in the graph properties panel. You need to assign them a name, type and an initial value.

logic designer graph variables

Once declared you can then reference a variable using the get, set and set reference nodes.

logic designer graph variables 1 graph variables 3

Decl variables​

Decl variables can be declared in the class/entity properties panel. Functionally they are identical to graph variables, the only real difference being that they are owned by the decl rather than a particular graph and can therefore be accessed from any graph in a class/entity decl.

Inline variables​

Inline variables are owned rather than referenced by a single node, making them less flexible but often more convenient than graph variables.

inline variables main

You can still modify inline variables however using the set reference node.

inline variables modify inline variables

You can also reference selected entities using inline variables.

inline variables reference selected entities

If you decide later on that you want a graph variable instead, you can promote the variable from the node's context menu.

inline variables promote variable

Lists​


Lists are collections of variables which you can add to, remove from, access via index and traverse.

list 1 list 2

Implicit Conversion​


For convenience some basic type conversions are handled automatically.

Any type can be converted to a list of the same type.
implicit conversion same type

You can also connect an int to a float or vice versa.
implicit conversion like types

References and Mutability​


By default all variable pins are constant (i.e. not modifiable) and the results of a node are passed via outputs. Reference variables are different; denoted by a white outline around the pin, they allow variables to be modified directly. This can be particularly useful when dealing with lists and types where copy operations are non-trivial.

There are also times when it is simply more convenient to use a reference like for example if you want to increment a number.

mutability

It is possible to link from a reference variable to a non-reference variable but not the other way around.