Quantcast

Moved multiple and single stat handling to a separate function

Kevin Lyles [02-19-10 - 03:05]
Moved multiple and single stat handling to a separate function
Filename
WeightsWatcher.lua
diff --git a/WeightsWatcher.lua b/WeightsWatcher.lua
index fd6a83b..f3d321d 100644
--- a/WeightsWatcher.lua
+++ b/WeightsWatcher.lua
@@ -968,26 +968,34 @@ function WeightsWatcher.parseLine(textL, textR, link)
 	if stats then
 		return stats
 	end
+	local stats = WeightsWatcher.parseStats(textL)
+	if stats then
+		return stats
+	end
+	for _, regex in ipairs(UnweightedLines) do
+		if string.find(textL, regex) then
+			ww_unweighted_lines[textL][regex] = true
+			return
+		end
+	end
+
+	ww_unparsed_lines[textL][link] = true
+end
+
+function WeightsWatcher.parseStats(text)
 	for _, regex in ipairs(MultipleStatLines) do
 		local pattern, func = unpack(regex)
-		if string.find(textL, pattern) then
-			local stats = func(textL, pattern)
+		if string.find(text, pattern) then
+			local stats = func(text, pattern)
 			if stats then
 				return stats
 			end
 		end
 	end
-	local stat = WeightsWatcher.singleStat(textL)
+	local stat = WeightsWatcher.singleStat(text)
 	if stat then
 		return stat
 	end
-	for _, regex in ipairs(UnweightedLines) do
-		if string.find(textL, regex) then
-			ww_unweighted_lines[textL][regex] = true
-			return
-		end
-	end
-	ww_unparsed_lines[textL] = true
 end

 function WeightsWatcher.getItemStats(link)