I’ve been attempting to sort an array using table.sort()
. And sometimes it works, and sometimes it doesn’t (but in a really weird way).
The array I’m sorting is called Times. The exact code that produces the output (shown in the image below) is:
print(Times) -- Unsorted
table.sort(Times)
print(Times) -- Sorted (supposedly)
As you can see though, the results are not sorted correctly.
I have no idea what’s causing this…
It runs through about 17+ arrays and uses table.sort()
to sort them. And for the first 10 or so, everything works fine, and the resulting array is sorted. But after that, it’s not getting sorted properly.
My initial guess was that I was just sorting too many arrays too fast, but after adding some task.wait(1)
's here and there, the result was the same.
And after running the code multiple times, the sorted (but not really sorted) result was the same…
Am I using table.sort()
wrong? Any advice or feedback would be greatly appreciated!