Support

Equilla Formula Language

CreateSortedIndexArrayLegacy

Creates a sorted index into an array, but in contrast to CreateSortedIndexArray this function processes the element at index 0. The array containing the actual data will remain unchanged. If IndexArray is a dynamic array, it gets resized to the length of DataArray. If IndexArray is fixed-size and the length of DataArray exceeds its length then a runtime error will be raised, otherwise all elements not containing an index into DataArray will be reset to the declared default value of IndexArray.

Inputs

DataArray
Array: The array containing the data to be sorted.
IndexArray
ArrayRef: The array receiving the sorted indices.
Order
Boolean: (Optional) Sort elements in ascending order.

Remarks

This functions behaves differently than the other array functions and processes the element at index 0 to be compatible with the vector function CreateSortedIndexVector.

Examples

Create a sorted index
Arrays: myDataArray[], myIndexArray[3]; FillArray( myDataArray, 4, 6, -5 ); CreateSortedIndexArrayLegacy( myDataArray, myIndexArray ); Print( myIndexArray[0], myIndexArray ); // prints 3 0 1 2