I have a professions button that i use to open prof1 and prof2 when ever i leftclick for prof1 i get this:
Code:
9x [ADDON_ACTION_FORBIDDEN] AddOn 'BasicUI' tried to call the protected function 'CastSpellByName()'.
[string "@!BugGrabber\BugGrabber.lua"]:519: in function <!BugGrabber\BugGrabber.lua:519>
[string "=[C]"]: in function `CastSpellByName'
[string "@BasicUI\Modules\Datapanel.lua"]:1763: in function <BasicUI\Modules\Datapanel.lua:1752>
Yet if i right click the same button it opens prof2 like it is suppose to.
Here is the code im using:
Code:
proPlugin:SetScript("OnMouseDown",function(self, button)
local prof1, prof2, _, _, _ = GetProfessions()
if button == "LeftButton" then
if prof1 then
CastSpellByName((GetProfessionInfo(prof1)))
else
print('|cff33ff99BasicUI:|r |cffFF0000No Profession Found!|r')
end
elseif button == 'MiddleButton' then
ToggleSpellBook(BOOKTYPE_PROFESSION)
elseif button == "RightButton" then
if prof2 then
CastSpellByName((GetProfessionInfo(prof2)))
else
print('|cff33ff99BasicUI:|r |cffFF0000No Profession Found!|r')
end
end
end)
Why does the leftbutton throw and error yet the middle and right do not?