# HG changeset patch
# User Kim Alvefur <zash@zash.se>
# Date 1652128617 -7200
# Node ID 03e307952816c64279c308614332f3b45c2993da
# Parent  87c3d45208efcbafde8d4ecc7d8d53eb5175f95f
util.jsonpointer: Fix Lua <5.3 compat

diff -r 87c3d45208ef -r 03e307952816 util/jsonpointer.lua
--- a/util/jsonpointer.lua	Sun May 08 18:04:50 2022 +0200
+++ b/util/jsonpointer.lua	Mon May 09 22:36:57 2022 +0200
@@ -1,3 +1,7 @@
+local m_type = math.type or function (n)
+	return n % 1 == 0 and n <= 9007199254740992 and n >= -9007199254740992 and "integer" or "float";
+end;
+
 local function unescape_token(escaped_token)
 	local unescaped = escaped_token:gsub("~1", "/"):gsub("~0", "~")
 	return unescaped
@@ -15,7 +19,7 @@
 
 		if type(idx) == "string" then
 			new_ref = ref[token]
-		elseif math.type(idx) == "integer" then
+		elseif m_type(idx) == "integer" then
 			local i = tonumber(token)
 			if token == "-" then
 				i = #ref + 1