util.jsonschema: Use same integer/float logic on Lua 5.2 and 5.3 0.12
authorKim Alvefur <zash@zash.se>
Sun, 09 Oct 2022 15:42:25 +0200
branch0.12
changeset 12764 ce1a0f9bf25a
parent 12763 ec54fe0003d5
child 12765 82915c755d90
child 12783 f0474d40364c
util.jsonschema: Use same integer/float logic on Lua 5.2 and 5.3 Fixes test case type.json:0:1 covering treatment of 1.0 as an integer according to the JSON definition
util/jsonschema.lua
--- a/util/jsonschema.lua	Sun Oct 09 15:38:36 2022 +0200
+++ b/util/jsonschema.lua	Sun Oct 09 15:42:25 2022 +0200
@@ -1,7 +1,7 @@
 -- This file is generated from teal-src/util/jsonschema.lua
 
-local m_type = math.type or function (n)
-	return n % 1 == 0 and n <= 9007199254740992 and n >= -9007199254740992 and "integer" or "float";
+local m_type = function(n)
+	return type(n) == "number" and n % 1 == 0 and n <= 9007199254740992 and n >= -9007199254740992 and "integer" or "float";
 end;
 local json = require("util.json")
 local null = json.null;