From 70e4b13d0e8eab8cf058c2db5750ee9bd5dababf Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Fri, 30 Jun 2023 15:02:26 +0200 Subject: util.jsonpointer: Silence Teal warning It seems to think 'table' never has array items, but we don't know that. --- teal-src/prosody/util/jsonpointer.tl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'teal-src/prosody') diff --git a/teal-src/prosody/util/jsonpointer.tl b/teal-src/prosody/util/jsonpointer.tl index c21e1fbf..af29bda0 100644 --- a/teal-src/prosody/util/jsonpointer.tl +++ b/teal-src/prosody/util/jsonpointer.tl @@ -23,7 +23,7 @@ local function resolve_json_pointer(ref : table, path : string) : any, ptr_error new_ref = ref[token] elseif idx is integer then local i = tonumber(token) - if token == "-" then i = #ref + 1 end + if token == "-" then i = #(ref as {any}) + 1 end new_ref = ref[i+1] else return nil, "invalid-table" -- cgit v1.2.3