Software /
code /
prosody
Diff
util/json.lua @ 6791:e813e8cf6046
Merge 0.10->trunk
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 20 Aug 2015 13:05:22 +0200 |
parent | 6785:bf1f09a5bcf7 |
child | 7235:ee1f7e1e548c |
line wrap: on
line diff
--- a/util/json.lua Mon Aug 17 01:58:53 2015 +0200 +++ b/util/json.lua Thu Aug 20 13:05:22 2015 +0200 @@ -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 = {