View Single Post
11-26-14, 02:55 AM   #21
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Go install Bugger, or at the very least, turn on the "Display Lua Errors" option under Interface Options > Help. Trying to write an addon without any way to see the errors that are occurring is like trying to put together a jigsaw puzzle in a lightless room. Sure, you can do it, eventually, but it will take a lot longer and be a lot more frustrating.

Here is one section of code that should be triggering an error message:
Code:
barQWindowCheckButton:SetScript("OnClick", 
  function()
	if barQWindow:IsShown() then
        barQWindow:Hide()
    else
        barQWindow:Show()
    end
   QWindowHide = self:IsChecked()
	barQWindowCheckButton:SetShown()	
  end
)
You're calling self:IsChecked() -- but no variable named self exists in that context. An OnClick script receives two arguments; the first is indeed typically named self, but you're not assigning those arguments to variables, so they're not accessible to your code.

Code:
barQWindowCheckButton:SetScript("OnClick", function(self, button) -- fixed!
There may be other errors as well, and you should fix them before assuming you're implementing an entire concept wrong. You may be (I just skimmed, and stopped reading after I found the above error) but it's just as likely that there's nothing wrong with your implementation, and your code is just failing on basic syntax or scoping errors.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote