Hello everyone,
I have a game that im creating where I need to quickly sort an array of Players by distance from the local player from least to greatest.
There’s numerous ways I could do this but I was looking to use table.sort() as it’s far faster (from what I can tell) than making my own sorting algorithm/implementing something like a quicksort algorithm.
I’ve had experience with using Java where you can use the Arrays class to sort arrays and implement your own comparison method, but I’m not sure of how to do this in Lua.
Is there a way I can do this or would it be best for me to implement my own sorting algorithm?