Extracts x elements from an array
Summary (oneliner)
Creates a new array with Chunk Size
elements starting from Start Index
, copies the values from the input array (shallow copy).
If there are less elements in the array than Chunk Size
, the size of the output array may be smaller.
*Example 1: *
- Input Array:
1, 2, 3, 4, 5
- Start Index:
2
- Chunk Size:
3
- Output Array:
3, 4, 5
*Example 2: *
- Input Array:
1, 2, 3, 4, 5
- Start Index:
3
- Chunk Size:
3
- Output Array:
4, 5
ArrayChunk has a special mode – Circular
– when set to true
, elements from the beginning of the array will be included:
Example 3:
- Input Array:
1, 2, 3
- Start Index:
1
- Chunk Size:
3
- Circular:
true
- Output Array:
2, 3, 1
Documentation (markdown)
Issues
Example patch id
Youtube ids (comma seperated)
Caniuse query
Inputs
The array to get a chunk out of
The index where the chunk should begin
How big the chunk should be, if there are not enough elements at the end of the Input Array
the chunk will be smaller
If true, values from the beginning will be taken when end reached
Outputs
Included Chunk Size
elements or less
Patches using ArrayChunk
Changelog
bugfix | do not crash when setting floats as begin/size, round down to next int 2023-03-29 - stephan |