Skip to content

Commit 6512100

Browse files
less intrusive Mod.Register
1 parent d1a436e commit 6512100

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

ModUtil.Main.lua

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ end
6060
modName - the name of the mod
6161
parent - the parent mod, or nil if this mod stands alone
6262
--]]
63-
function ModUtil.Mod.Register( first, second )
63+
function ModUtil.Mod.Register( first, second, meta )
6464
local modName, parent
6565
if type( first ) == "string" then
6666
modName, parent = first, second
@@ -71,7 +71,7 @@ function ModUtil.Mod.Register( first, second )
7171
parent = _G
7272
SaveIgnores[ modName ] = true
7373
end
74-
local mod = { }
74+
local mod = parent[ modName ] or { }
7575
parent[ modName ] = mod
7676
local path = ModUtil.Identifiers.Data[ parent ]
7777
if path ~= nil then
@@ -82,6 +82,9 @@ function ModUtil.Mod.Register( first, second )
8282
path = path .. modName
8383
ModUtil.Mods.Data[ path ] = mod
8484
ModUtil.Identifiers.Inverse[ path ] = mod
85+
if meta == false then
86+
return mod
87+
end
8588
return setmetatable( mod, ModUtil.Metatables.Mod )
8689
end
8790

0 commit comments

Comments
 (0)