As a developer of Vehicle Tycoon , we did an event where admin abuse come in priority. Our head admin just edited my stat for fun to try out our brand new admin system but the following just happened.
@MagicLuau we will investigate soon, given this thread has not been looked at in a while we would like to know if the issue is still reproducible/relevant by you?
Performing an impossible mathematical operation will return NaN value, at example dividing 0 by 0. But a NaN value is still type of number in Luau. That means you can preform any math operations with a NaN value, but any of them will return NaN. Also performing less operator “<” and less or equal operator “<=” will return false, no matter how you compare them. This is what could have caused the error in sorting algorithm.
local nan = 0/0
print(nan <= math.huge) -- Output: false
print(nan > math.huge) -- Output: false
Currently I was researching about NaN value and found out, that performing equal operator “==” on any non-NaN value with itself, at exmaple 1 == 1, will return true, expect NaN value.
local nan = 0/0 -- One of the ways to get NaN value, you can also try tonumber("nan")
print(nan == nan) -- Output: false
This is the only way how to detect a NaN value I found, but if you have systems that requires number input from client like admin abuse or cheaters, I recommend to check for a NaN value.