diff --git a/IceBarElement.lua b/IceBarElement.lua index 52387ce..3f31bcb 100644 --- a/IceBarElement.lua +++ b/IceBarElement.lua @@ -19,8 +19,8 @@ local lastMarkerHeightConfig = 6 local lastEditMarkerConfig = 1 -- Constructor -- -function IceBarElement.prototype:init(name) - IceBarElement.super.prototype.init(self, name) +function IceBarElement.prototype:init(name, ...) + IceBarElement.super.prototype.init(self, name, ...) end diff --git a/IceCore.lua b/IceCore.lua index ae35211..bc563c3 100644 --- a/IceCore.lua +++ b/IceCore.lua @@ -5,7 +5,7 @@ function IceCore_CreateClass(parent) setmetatable(class.prototype, { __index = parent.prototype }) end local mt = { __index = class.prototype } - function class.new(...) + function class:new(...) local self = setmetatable({}, mt) if self.init then self:init(...) diff --git a/IceElement.lua b/IceElement.lua index db4df94..03e3217 100644 --- a/IceElement.lua +++ b/IceElement.lua @@ -28,7 +28,7 @@ IceElement.prototype.bIsVisible = true -- IceElements are to be instantiated before IceCore is loaded. -- Therefore we can wait for IceCore to load and then register our -- module to the core with another event. -function IceElement.prototype:init(name) +function IceElement.prototype:init(name, skipRegister) assert(name, "IceElement must have a name") self.elementName = name @@ -42,7 +42,9 @@ function IceElement.prototype:init(name) LibStub("AceEvent-3.0"):Embed(self) LibStub("AceTimer-3.0"):Embed(self) - IceHUD:Register(self) + if not skipRegister then + IceHUD:Register(self) + end end diff --git a/modules/MirrorBar.lua b/modules/MirrorBar.lua index efe5142..f5287ab 100644 --- a/modules/MirrorBar.lua +++ b/modules/MirrorBar.lua @@ -18,7 +18,7 @@ MirrorBar.prototype.label = nil -- Constructor -- function MirrorBar.prototype:init(side, offset, name, db) - MirrorBar.super.prototype.init(self, name) + MirrorBar.super.prototype.init(self, name, true) self.settings = db self.moduleSettings = {} self.moduleSettings.side = side @@ -29,10 +29,6 @@ function MirrorBar.prototype:init(side, offset, name, db) self.moduleSettings.barVerticalOffset = 0 -- avoid nil warnings here self.moduleSettings.myTagVersion = IceHUD.CurrTagVersion - - -- unregister the event superclass registered, we don't want to register - -- this to the core - self:UnregisterEvent(IceCore.Loaded) end