diff State.lua @ 95:168cae4aa8bd

Fixes: - brute-force fix for invalid snippets - copying profile data now results in immediate changes - fixed keybinding tooltip display for pet bar simple actions Also did a little condensing of the state driver rule string generation
author Flick <flickerstreak@gmail.com>
date Wed, 22 Oct 2008 21:39:07 +0000
parents 5f1d7a81317c
children aa9074c92f11
line wrap: on
line diff
--- a/State.lua	Fri Oct 17 23:46:30 2008 +0000
+++ b/State.lua	Wed Oct 22 21:39:07 2008 +0000
@@ -195,7 +195,12 @@
 
     function RefreshState( bar )
       SetDefaultAnchor(bar)
-      bar:GetFrame():Execute([[control:RunAttribute("reaction-refresh")]])
+      bar:GetFrame():Execute(
+        [[
+          if self:GetAttribute("reaction-refresh") then
+            control:RunAttribute("reaction-refresh")
+          end
+        ]])
     end
 
     function SetStateDriver( bar, rule )
@@ -320,24 +325,15 @@
           -- strip out all spaces from the custom rule
           table.insert(rules, format("%s %s", c.custom:gsub("%s",""), state))
         end
-      elseif type == "any" then
-        if c.values then
-          local clauses = { }
-          for key, value in pairs(c.values) do
-            table.insert(clauses, format("[%s]", ruleformats[key]))
-          end
-          if #clauses > 0 then
-            table.insert(rules, format("%s %s", table.concat(clauses), state))
-          end
-        end
-      elseif type == "all" then
+      elseif type == "any" or type == "all" then
         if c.values then
           local clauses = { }
           for key, value in pairs(c.values) do
             table.insert(clauses, ruleformats[key])
           end
           if #clauses > 0 then
-            table.insert(rules, format("%s %s", format("[%s]", table.concat(clauses, ",")), state))
+            local sep = (type == "any") and "][" or ","
+            table.insert(rules, format("[%s] %s", table.concat(clauses,sep), state))
           end
         end
       end