Software /
code /
prosody
Diff
util/json.lua @ 6785:bf1f09a5bcf7
util.json: Remove use of newproxy
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 13 Mar 2015 21:11:33 +0100 |
parent | 5776:bd0ff8ae98a8 |
child | 7235:ee1f7e1e548c |
line wrap: on
line diff
--- a/util/json.lua Fri Mar 13 20:12:12 2015 +0100 +++ b/util/json.lua Fri Mar 13 21:11:33 2015 +0100 @@ -13,7 +13,7 @@ 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 @@ --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 = {