View Single Post
02-10-10, 05:46 AM   #5
nightcracker
A Molten Giant
 
nightcracker's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 716
The error is in the SetScript on line 149. SetScript accepts 2 parameters, the script and the function that should be called.

Code:
cb:SetScript("OnClick", setLoc(i))
This will generate an error This will happen if the onclick handler is called:

Code:
setLoc(i)(...)
Errors. This IS correct:

Code:
cb:SetScript("OnClick", function(i) setLoc(i) end)
Which will be called like this(function:2FJ39 is the link to the local function created by function(i) setLoc(i) end):

Code:
function:2FJ39(...)
And the most neat way is this:

Code:
cb:SetScript("OnClick", setLoc)
Which will get called like this:

Code:
setLoc(...)
Which is what we want.

Final thing, you are concatenating the i variable in your setLoc function, don't you mean this?

Code:
i = i:GetName()
__________________
Three things are certain,
Death, taxes and site not found,
You, victim of one.

Last edited by nightcracker : 02-10-10 at 05:48 AM.
  Reply With Quote