Lua Code:
local f = CreateFrame("Button","TabParty2",nil,"SecureActionButtonTemplate")
f:SetAttribute("type","target")
SecureHandlerWrapScript(f,"OnClick",f,[[
local unit
for i=1,5,1 do
TabPartyIndex = ((TabPartyIndex or 1) - 2)%5 + 1
if TabPartyIndex == 5 then
unit = "player"
else
unit = "party"..TabPartyIndex
end
if UnitExists(unit) then
self:SetAttribute("unit",unit)
break
end
end
]])
i=5,1,-1 or i=1,5,1 doesn't matter in this case.
The
real counting is:
Lua Code:
TabPartyIndex = (TabPartyIndex or 0)%5 + 1