Quantcast

Changed handling of "x by y" to be more strict

Kevin Lyles [04-18-10 - 20:06]
Changed handling of "x by y" to be more strict
Filename
Regexps.lua
diff --git a/Regexps.lua b/Regexps.lua
index ac083e0..63ddb51 100644
--- a/Regexps.lua
+++ b/Regexps.lua
@@ -836,7 +836,17 @@ SingleStatLines = {
 			end
 		end},
 	-- Tends to eat other stats if not last
-	{"^(%a+ ?%a+ ?%a+ ?%a+) by (%d+)$", WeightsWatcher.statNameFirst},
+	-- TODO: split this into a separate function instead of recursing?
+	{"^(%a+ ?%a+ ?%a+ ?%a+) by (%d+)$",
+		function(text, pattern)
+			local start, _, name, value = string.find(text, pattern)
+			if start then
+				local stats = WeightsWatcher.parseStats(value .. " " .. name)
+				if stats then
+					return stats
+				end
+			end
+		end},

 	{"^a minor movement speed increase$",
 		function(text, pattern)