That looks confusing to me.
You can blend Ace3 and vanilla WoW code easily enough.
Lua Code:
function Currency:OnInitialize()
Currency.eventFrame = CreateFrame("Frame") -- OnInit only fires once, so creating frames and setting their parameters here would be a good idea
end
function Currency:OnEnable()
-- mimic AceEvent without the callback or extra arg
-- basic functionality, but it works
-- you also gain RegisterUnitEvent yay!!
Currency.eventFrame:SetScript("OnEvent", function(self, event, ...)
Currency[event](Currency, ...) -- notice the change on this line?
end)
Currency.eventFrame:RegisterEvent("SOME_EVENT")
Currency.eventFrame:RegisterEvent("ANOTHER_EVENT")
Currency.eventFrame:RegisterUnitEvent("PLAYER_EVENT", "player", "target")
end
function Currency:OnDisable()
Currency.eventFrame:UnregisterAllEvents()
end
function Currency:SOME_EVENT()
-- do something
end
-- etc
-- etc
Here are some issues I have with your InitObjects()
- It is not a local function, but should be
- You have some things in there that should be done only once, like creating frames, which is presumably good, yet there are other things that ought to be handled multiple times like registering events
- Nothing wrong with having your event handlers inside that function, but it doesn't look easy to debug in a year or two