aboutsummaryrefslogtreecommitdiff
path: root/compat53/module.lua
diff options
context:
space:
mode:
authorHisham Muhammad <hisham@gobolinux.org>2024-08-29 17:14:46 -0300
committerGitHub <noreply@github.com>2024-08-29 17:14:46 -0300
commit1c679a282bf1255cddfbb6b3e8c5c72d9ebe57e8 (patch)
treea5fd29118c23b3438087fb1490b12cc4dedc015a /compat53/module.lua
parent11062dd41e77c9b03daf79f5838bedba6421753c (diff)
downloadlua-compat-5.3-1c679a282bf1255cddfbb6b3e8c5c72d9ebe57e8.tar.gz
lua-compat-5.3-1c679a282bf1255cddfbb6b3e8c5c72d9ebe57e8.tar.bz2
lua-compat-5.3-1c679a282bf1255cddfbb6b3e8c5c72d9ebe57e8.zip
fix: math.tointeger accepts strings convertible to integers (#66)
Diffstat (limited to 'compat53/module.lua')
-rw-r--r--compat53/module.lua1
1 files changed, 1 insertions, 0 deletions
diff --git a/compat53/module.lua b/compat53/module.lua
index 225d8ca..67b2a4a 100644
--- a/compat53/module.lua
+++ b/compat53/module.lua
@@ -115,6 +115,7 @@ if lua_version < "5.3" then
115 M.math.mininteger = minint 115 M.math.mininteger = minint
116 116
117 function M.math.tointeger(n) 117 function M.math.tointeger(n)
118 n = tonumber(n)
118 if type(n) == "number" and n <= maxint and n >= minint and n % 1 == 0 then 119 if type(n) == "number" and n <= maxint and n >= minint and n % 1 == 0 then
119 return n 120 return n
120 end 121 end