diff Config.lua @ 75:2127ab01ed4a

Overriding toggle boxes should no longer give errors. Adding / removing items from config groups works again. Fixed full support for the Cauldron crafting addon. No longer trying to queue crafting items when no tradeskill window is open. This would cause errors.
author Zerotorescue
date Sat, 25 Dec 2010 15:33:40 +0100
parents 6329ee822172
children 958aba5f3297
line wrap: on
line diff
--- a/Config.lua	Fri Dec 24 21:55:11 2010 +0100
+++ b/Config.lua	Sat Dec 25 15:33:40 2010 +0100
@@ -24,7 +24,7 @@
 			
 			local inheritedValue = addon:GetOptionByKey(groupName, info.arg);
 			
-			addon.db.profile.groups[groupName][info.arg] = (type(inheritedValue) ~= "table" and inheritedValue) or CopyTable(inheritedValue); -- copying defaults by reference would let one (unintendedly) change the defaults
+			addon.db.profile.groups[groupName][info.arg] = (type(inheritedValue) == "table" and CopyTable(inheritedValue)) or inheritedValue; -- copying defaults by reference would let one (unintendedly) change the defaults
 		end
 	end
 	
@@ -95,14 +95,14 @@
 	get = function(info)
 		return tostring(info[#info]); -- Ace is going to be anal about this if it's a numeric value, so we transmute it into a string here then back to a number on the other side
 	end,
-	set = function(groupId, itemId)
+	set = function(groupId, itemData)
     	-- This is NOT a real "set", we pass the widget reference to this function which contains similar, but not the same, info.
     	
-    	if itemId then
+    	if itemData and itemData.id then
 	    	local groupName = groupIdToName[groupId];
 	    	
-	    	if not mod:AddItemToGroup(groupName, itemId) then
-	    		print("|cffff0000Couldn't add the item with itemId (" .. itemId .. ") because it is already in a group.|r");
+	    	if not mod:AddItemToGroup(groupName, itemData.id) then
+	    		print("|cffff0000Couldn't add the item with itemId (" .. itemData.id .. ") because it is already in a group.|r");
 	    	end
     	end
 	end,
@@ -120,13 +120,13 @@
 	get = function(info)
 		return tostring(info[#info]); -- Ace is going to be anal about this if it's a numeric value, so we transmute it into a string here then back to a number on the other side
 	end,
-	set = function(groupId, itemId)
+	set = function(groupId, itemData)
     	-- This is NOT a real "set", we pass the widget reference to this function which contains similar, but not the same, info.
     	
-    	if itemId then
+    	if itemData and itemData.id then
 	    	local groupName = groupIdToName[groupId];
 	    	
-	    	mod:RemoveItemFromGroup(groupName, itemId);
+	    	mod:RemoveItemFromGroup(groupName, itemData.id);
 			
 			-- Now rebuild the list
 			AceConfigRegistry:NotifyChange("InventoriumOptions");