I've made some custom methods for working with arrays. They're mostly pretty simple, but handy to have in the toolbox. It's nice to share, so here they are! (Code below.)
|
|
|
|
|
|
|
ArraySplice(InputArray, SpliceIndex, DeleteLength, InsertArray) | | | | | | |
Removes and inserts elements in an array and returns a copy of it. | | InputArray | | Array | | The array to be modified |
| | SpliceIndex | | Int | | The index of the first element to be deleted and the point to insert new elements |
| | DeleteLength | | Int | | The number of elements to be deleted, including the element at SpliceIndex |
| | InsertArray | | Array | | The array to be inserted (optional) |
|
|
|
|
|
|
|
ArraySlice(InputArray, SliceIndex, SliceLength) | | | | | | |
Returns a portion of an array. | | InputArray | | Array | | The array to be extracted from |
| | SpliceIndex | | Int | | The index of the first element to be returned |
| | DeleteLength | | Int | | The number of elements to be returned, including the element at SliceIndex |
|
|
|
|
|
|
|
ArrayConcat(InputArray1, InputArray2) | | | | | | |
Returns an array made by joining two arrays together. | | InputArray1 | | Array | | The first array to join |
| | InputArray2 | | Array | | The second array to join |
|
|
|
|
|
|
|
ArrayReverse(InputArray) | | | | | | |
Returns an array that is the input array in reverse order. | | InputArray | | Array | | The array to be reversed |
|
|
|
|
|
|
|
ArraySort(InputArray, Descending) | | | | | | |
Sorts a numeric array and returns a copy of it. | | InputArray | | Array | | The array to sort. Must contain only numbers or integers |
| | Descending | | Boolean | | If true, the sort will be from highest to lowest (optional) |
|
|
|
|
|
|
|
ObjectArraySort(InputArray, Descending, Renumber) | | | | | | |
Sorts an array consisting of objects. | | InputArray | | Array | | The array to sort. Must contain only objects, which must all have a property "Index" |
This was made for a specific purpose. | | Descending | | Boolean | | If true, the sort will be from highest to lowest (optional) |
You may or may not find it useful! | | Renumber | | Boolean | | If true, the objects' "Index" properties will be updated to reflect the new order (optional) |
|
|
|
|
|
|
|