View Single Post
05-11-14, 11:29 AM   #19
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
Lua Code:
  1. function lf:OnEvent(event)
  2.   if (event == "ADDON_LOADED") then
  3.     CheckNewChar()
  4.   end
  5. end
  6. lf:SetScript("OnEvent", lf.OnEvent)

This is perfectly fine. The function lf:OnEvent makes OnEvent a method of the frame lf. When you assign lf.OnEvent to the event handler, self and event get passed through automatically. Using lf:OnEvent means that lf *is* self, so only event is needed in the parentheses.

Now.... He does still need to check if it was his addon that loaded.
__________________
"You'd be surprised how many people violate this simple principle every day of their lives and try to fit square pegs into round holes, ignoring the clear reality that Things Are As They Are." -Benjamin Hoff, The Tao of Pooh

  Reply With Quote