Thread: the _G changes.
View Single Post
09-17-10, 10:13 AM   #7
IQgryn
A Cyclonian
AddOn Author - Click to view addons
Join Date: Jul 2008
Posts: 46
Originally Posted by Grimsin View Post
my use of "this" in the tooltips code i changed to self and got a way different error, i dont think the use of this in that instance is the same as what was changed? if so i should of been able to simply change this to self or at lest that was my understanding.

the exact line that it starts in the 3rd chunk of code is this one, it says "this" is a nil value
_G[this:GetName().."EditBox"]:SetText(_G.GTipNotesDB[t] or "")

in the first chunk of code it is this one, this one says "frame" is a nil value
local region = GetNormalTexture(frame:GetRegions())

in the 2nd chunk of code im not sure which line it was i have to go back and check.
Unless you specifically declare a variable named this, any use of this is now invalid (and using it will cause nil errors). It's also not always just as simple as changing it to say self. That will usually work when you have a function definition of the form:
Code:
Frame:function()
Although even then, there can be problems. If your function is not declared like that (and the ones you posted aren't), you need to add a self parameter to the parameter list and update the code using the function to pass that along as well.

Note that if you add the parameter yourself, you don't have to call it self. You may use whatever name suits your fancy.