diff --git a/!Compatibility/api/luaAPI.lua b/!Compatibility/api/luaAPI.lua index c3f467c..b2f0ea2 100644 --- a/!Compatibility/api/luaAPI.lua +++ b/!Compatibility/api/luaAPI.lua @@ -46,11 +46,20 @@ function select(n, ...) return unpack(args) end +local huge = math.huge function math.modf(i) + i = type(i) ~= "number" and tonumber(i) or i + if type(i) ~= "number" then error(format("bad argument #1 to 'modf' (number expected, got %s)", i and type(i) or "no value"), 2) end + if i == 0 then + return i, i + elseif abs(i) == huge then + return i, i > 0 and 0 or -0 + end + local int = i >= 0 and floor(i) or ceil(i) return int, i - int