View Single Post
09-09-10, 01:11 AM   #6
Gorebag
A Deviate Faerie Dragon
AddOn Author - Click to view addons
Join Date: Oct 2008
Posts: 11
I guess I had followed a very old/bad sample when creating my XML for my handlers, because my original code had:

Code:
<OnLoad>QuestClicks_OnLoad();</OnLoad>
to define the OnLoad handler. I then relied on the "this" to access things.

In converting to "self", I found that I had to replace the above in the XML file with:

Code:
<OnLoad>QuestClicks_OnLoad(self);</OnLoad>
and update the definitions of the function in the LUA file to include the parameter. Without specifying the parameter in both locations, pretty much nothing happened/ran at all with my addon - the OnLoad method didn't seem to be called at all unless I included the parameter in the XML file.

When setting OnEvent, I currently have:

Code:
self:SetScript("OnEvent", QuestClicks_OnEvent);
in lua. The QuestClicks_OnEvent function is defined as:

Code:
function QuestClicks_OnEvent(self, event, ...)
"arg1", etc still get set (as locals) this way inside the OnEvent handler without needing to add a "local arg1, arg2 = ..." line.

Last edited by Gorebag : 09-09-10 at 01:13 AM.