Mercurial > wow > reaction
diff modules/ReAction_Action/ReAction_Action.lua @ 52:c9df7866ff31
Added anchor snapping
author | Flick <flickerstreak@gmail.com> |
---|---|
date | Thu, 24 Apr 2008 19:19:42 +0000 |
parents | c3c64e2def50 |
children | 7e09c02ae620 |
line wrap: on
line diff
--- a/modules/ReAction_Action/ReAction_Action.lua Tue Apr 22 21:33:37 2008 +0000 +++ b/modules/ReAction_Action/ReAction_Action.lua Thu Apr 24 19:19:42 2008 +0000 @@ -48,9 +48,7 @@ end function module:ApplyToBar(bar) - if bar.config.type == "actionbar" then - self:RefreshBar(bar) - end + self:RefreshBar(bar) end function module:RefreshBar(bar) @@ -73,15 +71,20 @@ btnCfg[i] = {} end if btns[i] == nil then - btns[i] = self.BtnClass:new(bar,i,btnCfg[i]) + local ok, b = pcall(self.BtnClass.new, self.BtnClass, bar, i, btnCfg[i]) + if ok and b then + btns[i] = b + end else btns[i]:Refresh(bar,i) end end for i = n+1, #btns do - btns[i] = btns[i]:Destroy() - if btnCfg[i] then - btnCfg[i] = nil + if btns[i] then + btns[i] = btns[i]:Destroy() + if btnCfg[i] then + btnCfg[i] = nil + end end end end @@ -142,7 +145,7 @@ end function module:showActionIDLabel(button) - if not button.actionIDLabel then + if not button.actionIDLabel and button:GetActionID() then local label = button:GetFrame():CreateFontString(nil,"OVERLAY","GameFontNormalLarge") label:SetAllPoints() label:SetJustifyH("CENTER") @@ -172,6 +175,7 @@ return i end end + error("ran out of action IDs") else local c = rawget(self,idx) or 0 rawset(self,idx,c+1) @@ -238,7 +242,9 @@ if self.name then _G[self.name] = nil end - ActionIDList[self.config.actionID] = nil + if self.config.actionID then + ActionIDList[self.config.actionID] = nil + end self.frame = nil self.config = nil self.bar = nil