diff ReAction.lua @ 127:29dacbecdb52

Fixed handling for making new bars with the same name
author Flick <flickerstreak@gmail.com>
date Wed, 04 Mar 2009 21:19:32 +0000
parents a2d2f23137c8
children 8cc187143acd
line wrap: on
line diff
--- a/ReAction.lua	Tue Mar 03 23:18:35 2009 +0000
+++ b/ReAction.lua	Wed Mar 04 21:19:32 2009 +0000
@@ -306,7 +306,12 @@
 function ReAction:CreateBar(name, config, ...)
   local profile = self.db.profile
 
-  if not name then
+  if name then
+    if bars[name] then
+      self:UserError(format(L["ReAction: name '%s' already in use"],name))
+      return nil
+    end
+  else
     local prefix = L["Bar "]
     local i = 1
     repeat
@@ -371,8 +376,11 @@
     error("ReAction:RenameBar() - second argument must be a string")
   end
   if bar and name and #newname > 0 then
+    if newname == name then
+      return
+    end
     if bars[newname] then
-      self:UserError(("%s ('%s')"):format(L["ReAction: name already in use"],newname))
+      self:UserError(format(L["ReAction: name '%s' already in use"],newname))
     else
       bars[newname], bars[name] = bars[name], nil
       bar:SetName(newname or "")