mirror of
https://github.com/appgurueu/modlib.git
synced 2024-11-25 16:53:46 +01:00
Fix undeclared global assignment warnings
This commit is contained in:
parent
77977a52e7
commit
7c3ec02505
3
mod.lua
3
mod.lua
@ -24,10 +24,11 @@ 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})
|
||||
parent_namespace[namespace_name] = namespace
|
||||
-- prevent MT's warning
|
||||
if parent_namespace == _G then
|
||||
rawset(parent_namespace, namespace_name, namespace)
|
||||
else
|
||||
parent_namespace[namespace_name] = namespace
|
||||
end
|
||||
return namespace
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user