Forbid mutating empty_json_array

It's definitely still possible (rawset), but should prevent people
accidentally trying to modify it when they shouldn't.
This commit is contained in:
SquidDev
2019-05-30 20:01:09 +01:00
parent 0cb659d78c
commit e839ef54af
2 changed files with 12 additions and 1 deletions
@@ -240,7 +240,11 @@ local function serializeImpl( t, tTracking, sIndent )
end
end
empty_json_array = {}
empty_json_array = setmetatable({}, {
__newindex = function()
error("attempt to mutate textutils.empty_json_array", 2)
end
})
local function serializeJSONImpl( t, tTracking, bNBTStyle )
local sType = type(t)