CBA_fnc_sortNestedArray - Preserve order of elements with same sorting value#1271
Conversation
…th same sorting value
|
I don't get it. |
|
Updated the example to be more clear. My use case for this is an array of actions (each with a priority). This addition will allow actions to be sorted in terms of decreasing priority (like current), but also keep actions with the same priority in the order they were added - instead of performing additional unwanted sorting on the full "action sub-arrays". |
Shouldn't that always be the case?
Seems like a bug/oversight to me. I think this does not need additional syntax, but just always sort the way your alt syntax is now. This is the original: https://github.com/CBATeam/CBA_A3/blob/79d52a8338fc9457e6830530794ab6ed03eefd4b/addons/arrays/fnc_sortNestedArray.sqf |
|
|
||
| { | ||
| _helperArray pushBack [_x select _index, _coefficient * _forEachIndex, _x]; | ||
| } forEach _array; |
There was a problem hiding this comment.
Please keep the apply to save N pushBack commands.
private _helperArray = _array apply {
[_x select _index, _coefficient * _forEachIndex, _x]
};There was a problem hiding this comment.
no _forEachIndex in apply
When merged this pull request will:
Example (before changing to default behaviour):