X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=util%2Fjson.lua;h=becd295d55590e4757736c8a9cc1b4c16e7d834f;hb=a8958cbe5ebad3abc12efa7a76c8aedac8f21389;hp=a8a58afcd12062267cf63414d905e9d6c75c75bc;hpb=f6b3f550857678d676b31c5338f4bc6a93df1339;p=prosody.git diff --git a/util/json.lua b/util/json.lua index a8a58afc..becd295d 100644 --- a/util/json.lua +++ b/util/json.lua @@ -13,7 +13,7 @@ local tostring, tonumber = tostring, tonumber; local pairs, ipairs = pairs, ipairs; local next = next; local error = error; -local newproxy, getmetatable, setmetatable = newproxy, getmetatable, setmetatable; +local getmetatable, setmetatable = getmetatable, setmetatable; local print = print; local has_array, array = pcall(require, "util.array"); @@ -22,10 +22,7 @@ local array_mt = has_array and getmetatable(array()) or {}; --module("json") local json = {}; -local null = newproxy and newproxy(true) or {}; -if getmetatable and getmetatable(null) then - getmetatable(null).__tostring = function() return "null"; end; -end +local null = setmetatable({}, { __tostring = function() return "null"; end; }); json.null = null; local escapes = {