From fcd53ba269952b6462ab42d76e080c24098c9bdc Mon Sep 17 00:00:00 2001 From: Lars Mueller Date: Sat, 25 Feb 2023 20:33:24 +0100 Subject: [PATCH] Fix `json.new` setting an invalid metatable --- json.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/json.lua b/json.lua index 94e7763..17950cb 100644 --- a/json.lua +++ b/json.lua @@ -1,5 +1,5 @@ -local modlib, setmetatable, pairs, assert, error, table, 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 +local modlib, setmetatable, pairs, assert, error, 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 = {} setfenv(1, _ENV) @@ -17,7 +17,7 @@ do null = setmetatable({}, metatable) end -local metatable = {__index = self} +local metatable = {__index = _ENV} _ENV.metatable = metatable function new(self) return setmetatable(self, metatable)