mirror of
https://github.com/appgurueu/modlib.git
synced 2024-11-25 16:53:46 +01:00
Remove builtin global strictness
This commit is contained in:
parent
7c3ec02505
commit
98c702ee28
2
init.lua
2
init.lua
@ -1,3 +1,5 @@
|
||||
-- Silence builtin/strict.lua
|
||||
setmetatable(_G, {})
|
||||
-- Lua version check
|
||||
if _VERSION then
|
||||
if _VERSION < "Lua 5" then
|
||||
|
8
mod.lua
8
mod.lua
@ -24,12 +24,8 @@ function create_namespace(namespace_name, parent_namespace)
|
||||
namespace_name = namespace_name or minetest.get_current_modname()
|
||||
parent_namespace = parent_namespace or _G
|
||||
local namespace = setmetatable({}, {__index = parent_namespace})
|
||||
-- prevent MT's warning
|
||||
if parent_namespace == _G then
|
||||
rawset(parent_namespace, namespace_name, namespace)
|
||||
else
|
||||
parent_namespace[namespace_name] = namespace
|
||||
end
|
||||
-- should use rawset if MT's strictness wasn't disabled in init.lua
|
||||
parent_namespace[namespace_name] = namespace
|
||||
return namespace
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user