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