Get
The element of an array at an index.
Node id array/get
The Get node outputs the element of array at position index. The
first element is at index 0.
Inputs
| Name | Type | Default | Notes |
|---|---|---|---|
| array | Array<T> | — | generic |
| index | number | 0 |
Outputs
| Name | Type | Notes |
|---|---|---|
| element | T | generic |
Behaviour
- Negative indices count from the end, as in JavaScript's
Array.at: -1 is the last element, -2 the one before it. - The array is unchanged. Get only reads; to take the element out, use Pull.
- Output type. The output takes the element type of the connected
array: Get on an
Array<Circle>outputs a Circle.
Errors
indexmust be a whole number.- It must be inside the array: from 0 to length - 1, or from -length to -1. Any index is out of range for an empty array (or an unconnected one).
Related nodes
- Pull: takes an element out of the array.
- Length: how many elements there are.
- Random Integer: a random index.