Fix json.new setting an invalid metatable

This commit is contained in:
Lars Mueller 2023-02-25 20:33:24 +01:00
parent 72ca08ed3a
commit fcd53ba269

@ -1,5 +1,5 @@
local modlib, setmetatable, pairs, assert, error, table, table_insert, table_concat, tonumber, tostring, math_huge, string, type, next local modlib, setmetatable, pairs, assert, error, table_insert, table_concat, tonumber, tostring, math_huge, string, type, next
= modlib, setmetatable, pairs, assert, error, table, table.insert, table.concat, tonumber, tostring, math.huge, string, type, next = modlib, setmetatable, pairs, assert, error, table.insert, table.concat, tonumber, tostring, math.huge, string, type, next
local _ENV = {} local _ENV = {}
setfenv(1, _ENV) setfenv(1, _ENV)
@ -17,7 +17,7 @@ do
null = setmetatable({}, metatable) null = setmetatable({}, metatable)
end end
local metatable = {__index = self} local metatable = {__index = _ENV}
_ENV.metatable = metatable _ENV.metatable = metatable
function new(self) function new(self)
return setmetatable(self, metatable) return setmetatable(self, metatable)