Get the sign of a number (1 for positive numbers, -1 for negative numbers, and 0 for zero):
local function sign(n)
return n > 0 and 1 or (n < 0 and -1 or 0)
end
Get the sign of a number (1 for positive numbers, -1 for negative numbers, and 0 for zero):
local function sign(n)
return n > 0 and 1 or (n < 0 and -1 or 0)
end