# HG changeset patch # User Kim Alvefur # Date 1652128745 -7200 # Node ID 88e1b94105aeb970a0c64dc15492d02437c2458f # Parent 03e307952816c64279c308614332f3b45c2993da util.jsonschema: Lua <5.3 compat here too diff -r 03e307952816 -r 88e1b94105ae util/jsonschema.lua --- a/util/jsonschema.lua Mon May 09 22:36:57 2022 +0200 +++ b/util/jsonschema.lua Mon May 09 22:39:05 2022 +0200 @@ -1,3 +1,6 @@ +local m_type = math.type or function (n) + return n % 1 == 0 and n <= 9007199254740992 and n >= -9007199254740992 and "integer" or "float"; +end; local json = require("util.json") local null = json.null; @@ -17,7 +20,7 @@ elseif schema == "array" and type(data) == "table" then return type(data) == "table" and (next(data) == nil or type((next(data, nil))) == "number") elseif schema == "integer" then - return math.type(data) == schema + return m_type(data) == schema elseif schema == "null" then return data == null else