Toggle party in raid - error
oUF gurus,
I am setting up my oUF layout and getting an error. Any help with my logic here would be great. This is not an oUF 1.4 compatible layout, will do that soon.
Error:
layout.lua:1463: attempt to index global 'party' (a nil value)
I highlighted and bolded line 1463 in red. This is the "party toggle in raid" section, which is causing the problems.
Code:
--
-- party
--
if(not (playerClass=="PRIEST") and (showparty == true)) then
local party = oUF:Spawn("header", "oUF_Party")
party:SetManyAttributes(
"showParty", true,
"showSolo", false,
"yOffset", 105)
party:SetPoint("TOPLEFT", player, -245, 25)
--party:SetAttribute("showRaid", true)
end
--
-- partypets
--
if(not (playerClass=="PRIEST") and (showpartypets == true)) then
local partypet = {}
partypet[1] = oUF:Spawn('partypet1', 'oUF_PartyPet1')
partypet[1]:SetPoint('TOPLEFT', party, 'TOPLEFT', -75, 0)
for i =2, 4 do
partypet[i] = oUF:Spawn('partypet'..i, 'oUF_PartyPet'..i)
partypet[i]:SetPoint('TOP', partypet[i-1], 'BOTTOM', 0, 105)
end
end
--
-- raid
--
if (not(playerClass=="PRIEST") and (showraid == true)) then
local raid = {} -- group 1-5 only
for i = 1, 5 do
table.insert(raid, oUF:Spawn("header", "oUF_Raid"..i))
if i == 1 then
raid[i]:SetPoint("LEFT", UIParent, "LEFT", 25, -25)
else
raid[i]:SetPoint("CENTER", raid[i-1], "CENTER", 0, -42)
end
raid[i]:SetManyAttributes(
--"showParty", false,
"showPlayer", true,
"showRaid", true,
"showSolo", false,
"columnSpacing", 10, -- default was 8
"unitsPerColumn", 1,
"maxColumns", 5,
"columnAnchorPoint", "LEFT",
"xOffset", 12,
"groupFilter", i )
end
end
--
-- party toggle in raid
--
if (not (playerClass=="PRIEST")) then
local partyToggle = CreateFrame('Frame')
partyToggle:RegisterEvent('PLAYER_LOGIN')
partyToggle:RegisterEvent('RAID_ROSTER_UPDATE')
partyToggle:RegisterEvent('PARTY_LEADER_CHANGED')
partyToggle:RegisterEvent('PARTY_MEMBERS_CHANGED')
partyToggle:SetScript('OnEvent', function(self)
if InCombatLockdown() then
self:RegisterEvent("PLAYER_REGEN_ENABLED")
else
self:UnregisterEvent("PLAYER_REGEN_ENABLED")
local numraid = GetNumRaidMembers()
if numraid > 5 then
if showparty == true then
party:Hide()
end
if showraid == true then
raid:Show()
end
else
if showparty == true then
party:Show()
end
if showraid == true then
raid:Hide()
end
end
end
end)
end
My entire layout if this helps: http://pastey.net/138864
Thanks!!
|