Software /
code /
prosody
Comparison
util/jsonschema.lua @ 12760:ce1a0f9bf25a 0.12
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
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 09 Oct 2022 15:42:25 +0200 |
parent | 12759:ec54fe0003d5 |
child | 12975:d10957394a3c |
comparison
equal
deleted
inserted
replaced
12759:ec54fe0003d5 | 12760:ce1a0f9bf25a |
---|---|
1 -- This file is generated from teal-src/util/jsonschema.lua | 1 -- This file is generated from teal-src/util/jsonschema.lua |
2 | 2 |
3 local m_type = math.type or function (n) | 3 local m_type = function(n) |
4 return n % 1 == 0 and n <= 9007199254740992 and n >= -9007199254740992 and "integer" or "float"; | 4 return type(n) == "number" and n % 1 == 0 and n <= 9007199254740992 and n >= -9007199254740992 and "integer" or "float"; |
5 end; | 5 end; |
6 local json = require("util.json") | 6 local json = require("util.json") |
7 local null = json.null; | 7 local null = json.null; |
8 | 8 |
9 local pointer = require("util.jsonpointer") | 9 local pointer = require("util.jsonpointer") |