Remove builtin global strictness

This commit is contained in:
Lars Mueller 2020-11-15 11:28:05 +01:00
parent 7c3ec02505
commit 98c702ee28
2 changed files with 4 additions and 6 deletions

@ -1,3 +1,5 @@
-- Silence builtin/strict.lua
setmetatable(_G, {})
-- Lua version check -- Lua version check
if _VERSION then if _VERSION then
if _VERSION < "Lua 5" then if _VERSION < "Lua 5" then

@ -24,12 +24,8 @@ function create_namespace(namespace_name, parent_namespace)
namespace_name = namespace_name or minetest.get_current_modname() namespace_name = namespace_name or minetest.get_current_modname()
parent_namespace = parent_namespace or _G parent_namespace = parent_namespace or _G
local namespace = setmetatable({}, {__index = parent_namespace}) local namespace = setmetatable({}, {__index = parent_namespace})
-- prevent MT's warning -- should use rawset if MT's strictness wasn't disabled in init.lua
if parent_namespace == _G then parent_namespace[namespace_name] = namespace
rawset(parent_namespace, namespace_name, namespace)
else
parent_namespace[namespace_name] = namespace
end
return namespace return namespace
end end