Software /
code /
prosody
Diff
util/startup.lua @ 12782:8815d3090928
util.mathcompat: Module to ease reuse of math.type()
Mostly to ensure it is available during tests, as util.startup is not
invoked there
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 20 Oct 2022 16:50:12 +0200 |
parent | 12781:22066b02887f |
child | 12864:9f9633364044 |
line wrap: on
line diff
--- a/util/startup.lua Wed Oct 19 16:25:05 2022 +0200 +++ b/util/startup.lua Thu Oct 20 16:50:12 2022 +0200 @@ -280,16 +280,7 @@ -- COMPAT Lua < 5.3 if not math.type then - -- luacheck: ignore 122/math - function math.type(n) - if type(n) == "number" then - if n % 1 == 0 and (n + 1 ~= n and n - 1 ~= n) then - return "integer" - else - return "float" - end - end - end + require "util.mathcompat" end end