Quantcast

In addon:ScanTrainerData(): Fixed output logic.

James D. Callahan III [04-14-10 - 02:55]
In addon:ScanTrainerData(): Fixed output logic.
Filename
Scanner.lua
diff --git a/Scanner.lua b/Scanner.lua
index 115cdd3..dec29ce 100644
--- a/Scanner.lua
+++ b/Scanner.lua
@@ -714,9 +714,7 @@ do
 		local teachflag = false
 		local noteachflag = false

-		for i in pairs(recipe_list) do
-			local recipe = recipe_list[i]
-			local i_name = recipe.name
+		for spell_id, recipe in pairs(recipe_list) do
 			local train_data = recipe.acquire_data[A.TRAINER]
 			local found = false

@@ -729,16 +727,20 @@ do
 				end
 			end

-			if info[i_name] and not found then
-				tinsert(teach, i)
-				teachflag = true
+			if info[recipe.name] then
+				if not found then
+					tinsert(teach, spell_id)
+					teachflag = true

-				if not recipe:IsFlagged("common1", "TRAINER") then
-					tinsert(output, ": Trainer flag needs to be set.")
+					if not recipe:IsFlagged("common1", "TRAINER") then
+						tinsert(output, ": Trainer flag needs to be set.")
+					end
+				end
+			else
+				if found then
+					noteachflag = true
+					tinsert(noteach, spell_id)
 				end
-			elseif found then
-				noteachflag = true
-				tinsert(noteach, i)
 			end
 		end