Hello again
I have the following portion of code:
Lua Code:
local MaxGroup = CreateFrame("Frame", "SanUIRaidMaxGroup")
MaxGroup:RegisterEvent("PLAYER_ENTERING_WORLD")
MaxGroup:RegisterEvent("ZONE_CHANGED_NEW_AREA")
MaxGroup:SetScript("OnEvent", function(self)
local filter
local inInstance, instanceType = IsInInstance()
local _, _, _, _, maxPlayers, _, _ = GetInstanceInfo()
if maxPlayers == 25 then
filter = twentyfive
elseif maxPlayers == 10 then
filter = ten
else
filter = forty
end
if inInstance and instanceType == "raid" then
SanUIRaid:SetAttribute("groupFilter", filter)
if C.unitframes.showraidpets then
SanUIRaidPets:SetAttribute("groupFilter", filter)
end
else
SanUIRaid:SetAttribute("groupFilter", "1,2,3,4,5,6,7,8")
if C.unitframes.showraidpets then
SanUIRaidPets:SetAttribute("groupFilter", "1,2,3,4,5,6,7,8")
end
end
end)
SanUIRaid and SanUIRaidPets are the headers for raid/pets. I sometimes get the following errors:
Code:
2x [ADDON_ACTION_BLOCKED] AddOn 'Tukui' hat versucht die geschützte Funktion 'SanUIRaid:SetAttribute()' aufzurufen.
AddOns\!BugGrabber\BugGrabber.lua:581: in function <AddOns\!BugGrabber\BugGrabber.lua:581>
[C]: in function `SetAttribute'
AddOns\SanUI\raidframes.lua:910: in function <AddOns\SanUI\raidframes.lua:891>
Locals:
nil
Code:
2x [ADDON_ACTION_BLOCKED] AddOn 'Tukui' hat versucht die geschützte Funktion 'SanUIRaidPets:SetAttribute()' aufzurufen.
AddOns\!BugGrabber\BugGrabber.lua:581: in function <AddOns\!BugGrabber\BugGrabber.lua:581>
[C]: in function `SetAttribute'
AddOns\SanUI\raidframes.lua:912: in function <AddOns\SanUI\raidframes.lua:891>
Locals:
nil
The error message translates to english as "Addon Tukui tried to call the protected function 'SanUIRaid:SetAttribute()' ", which is a bit strange, since the code does not belong to the addon Tukui (but I use Tukui as a basis and there might be some spawn magic I don't understand; my guess is that this does not really matter). Lines 910 and 912 are the last two SetAttribute calls in the code, but it might be that at other times (i.e. when I'm in a raid) those other 2 calls are the problems. If the full code would be more helpfull, I suggest you download
SanUI, the file would be SanUI/raidframes.lua.
The error isn't really reproduceable. A guess would be that this happens at the rare occasions where PLAYER_ENTERING_WORLD or ZONE_CHANGED_NEW_AREA fire while in combat (which isn't easily tested, so I'm not sure).
What's the problem here? Is SetAttribute not useable in combat? I thought that was the point of SetAttribute to let you change table entries you can't access directly... Thanks for any help and pointers!