Changeset

13163:f43d04653bcf

util.jsonschema: Silence Teal warnings about utf8 library Teal worries that we redefine the global. Also that the fallback was missing type information.
author Kim Alvefur <zash@zash.se>
date Sat, 17 Jun 2023 17:17:44 +0200
parents 13162:6140aa67c618
children 13164:1aa83a5667f9
files teal-src/prosody/util/jsonschema.tl util/jsonschema.lua
diffstat 2 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/teal-src/prosody/util/jsonschema.tl	Sat Jun 17 17:12:54 2023 +0200
+++ b/teal-src/prosody/util/jsonschema.tl	Sat Jun 17 17:17:44 2023 +0200
@@ -11,8 +11,8 @@
 if not math.type then require "prosody.util.mathcompat" end
 
 
-local utf8 = rawget(_G, "utf8") or require"prosody.util.encodings".utf8;
-local utf8_len = utf8.len or function(s)
+local utf8_enc = rawget(_G, "utf8") or require"prosody.util.encodings".utf8;
+local utf8_len = utf8_enc.len or function(s : string) : integer
 	local _, count = s:gsub("[%z\001-\127\194-\253][\128-\191]*", "");
 	return count;
 end;
--- a/util/jsonschema.lua	Sat Jun 17 17:12:54 2023 +0200
+++ b/util/jsonschema.lua	Sat Jun 17 17:17:44 2023 +0200
@@ -4,8 +4,8 @@
 	return type(n) == "number" and n % 1 == 0 and n <= 9007199254740992 and n >= -9007199254740992 and "integer" or "float";
 end;
 
-local utf8 = rawget(_G, "utf8") or require("prosody.util.encodings").utf8;
-local utf8_len = utf8.len or function(s)
+local utf8_enc = rawget(_G, "utf8") or require("prosody.util.encodings").utf8;
+local utf8_len = utf8_enc.len or function(s)
 	local _, count = s:gsub("[%z\001-\127\194-\253][\128-\191]*", "");
 	return count
 end;