How to use sortWithFunction?
-
Tried this but it doesn't work, what's the correct usage?
reg arr = [5, 3, 6, 4, 1, 2]; Engine.sortWithFunction(arr, function(a, b) { return a > b; }); Console.print(trace(arr));
-
@d-healey Two minutes digging around on the internet leads me to the solution
reg arr = [5, 3, 6, 4, 1, 2]; Engine.sortWithFunction(arr, function(a, b) { if (a < b) return -1 else return a > b; }); Console.print(trace(arr));