Thread Tools Display Modes
09-07-10, 04:20 PM   #1
ezarra
A Flamescale Wyrmkin
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 123
RegisterEvent in Beta

I was trying to fix a mod (the joys of someone else's code ). The mod is old and was still using the

Code:
this:RegisterEvent("");
syntax, which obviously does not work in WoW4. I had read that the preferred method now is self:RegisterEvent, but that failed with the same error (could not index self/this a nil value).

I did finally get it to work, or at least to not error, by specifying the frame name:

MyFrame:RegisterEvent("VARIABLES_LOADED");

but I still don't think that's right.
__________________
Dude, if you wanted to win, why'd you let me play?
 
09-07-10, 04:23 PM   #2
Seerah
Fishing Trainer
 
Seerah's Avatar
WoWInterface Super Mod
Featured
Join Date: Oct 2006
Posts: 10,860
That is correct.
__________________
"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

 
09-08-10, 03:11 AM   #3
Vlad
A Molten Giant
 
Vlad's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2005
Posts: 793
This is outdated, self is only usable in some situations but it's hard to explain it in layman terms.

In short, if you do a FrameName:SetScript() the function called always has a "(self, ...)" where self is "FrameName". Why? Because typing ":" will make the object on the left side become "self" -don't get confused.
 
 

WoWInterface » AddOns, Compilations, Macros » Cataclysm Beta » RegisterEvent in Beta

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off