Arrays
Thirteen nodes for working with lists of values. Every node except
MakeArray takes the array to operate on through a required Array input
pin.
Elements are Variants — values whose type is not fixed — so reading one out
often needs Variant_ConvertTo before you can
use it.
Building an array
MakeArray
| Execution | in, out |
| Data in | Elements — one pin per entry you add |
| Data out | Array |
| Property | Elements |
Add entries to the Elements property and the node grows an input pin for each.
Reading
| Node | Title | Data in | Data out |
|---|---|---|---|
GetCount | — | Array | "" — Int |
IsEmpty | — | Array | "" — Bool |
Array_GetElement | GetElement[{Index}] | Array, Index — Int | Element — Variant |
Array_Contains | Contains {Element} | Array, Element | "" — Bool |
Array_IndexOf | IndexOf {Element} | Array, Element, StartIndex — Int | "" — Int |
None of these have execution pins — they are data nodes, evaluated on demand.
Array_IndexOf returns the position of the first match at or after
StartIndex.
Modifying
All of these have execution pins, because they change something.
| Node | Title | Data in |
|---|---|---|
PushBack | — | Array, Element |
PushBackRange | — | Array, Range — Array |
Insert | — | Array, Element, Index — Int |
Array_SetElement | SetElement[{Index}] | Array, Index — Int, Element |
Array_Remove | Remove {Element} | Array, Element |
Array_RemoveAt | RemoveAt {Index} | Array, Index — Int |
Clear | — | Array |
PushBack appends one element; PushBackRange appends every element of another
array.
Remove searches for a matching value; RemoveAt takes a position.
Walking an array
Use ForEachLoop,
which gives you Element and Index outputs and a LoopBody execution pin. It is
almost always clearer than a ForLoop with GetElement inside.
ForEachLoop [LoopBody] -> (do something with each element)
ForEachLoop [Element] -> Variant_ConvertTo [Variant]
ForEachLoop [Completed] -> (carry on afterwards)
Six array nodes live inside an Array folder — GetCount,
IsEmpty, Clear, Insert, PushBack and
PushBackRange.
The rest are top-level nodes that merely start with Array_:
Array_GetElement, Array_SetElement, Array_Contains, Array_IndexOf,
Array_Remove and Array_RemoveAt. MakeArray is top-level too.
They all behave the same way; only where you find them differs. This is a quirk of the engine source, so search by name rather than browsing the folder.
See Also
- Conversion and Text — getting values out of Variants
- Logic and Math — loop nodes