Right now in my addon, I tend to use self a lot to refer to the addon table as created by AceAddon, e.g.:
myAddon = LibStub("AceAddon-3.0"):NewAddon("myAddon", "AceConsole-3.0")
However, I run into trouble with this when I try to use my functions in places where my addon table isn't actually making the call (e.g., in event handlers). For example, if I
on a frame, obviously when func1 is called, self no longer refers to my addon. I've tried fixing this by changing the references to "self" in the particular function that I'm dealing with to "myAddon" instead; however, for whatever reason this doesn't seem to work in practice and it seems to change the functionality of things that were working previously (it doesn't seem to interact with AceDB correctly or something). I've been getting around this by doing things like this instead:
SetScript("OnShow", function() self:func1() end)
Is there something in particular I'm doing wrong that causes this problem in the first place?