Quantcast

Changed preprocessing patterns to be used in a set order

Kevin Lyles [01-08-10 - 19:08]
Changed preprocessing patterns to be used in a set order
Filename
Regexps.lua
WeightsWatcher.lua
diff --git a/Regexps.lua b/Regexps.lua
index 5448cd4..6153c19 100644
--- a/Regexps.lua
+++ b/Regexps.lua
@@ -100,9 +100,9 @@ function WeightsWatcher.newStatTable(tbl)
 end

 Preprocess = {
-	["|r$"] = "",
-	["^|c[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]"] = "",
-	[" +$"] = "",
+	{"|r$", ""},
+	{"^|c[a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9][a-f0-9]", ""},
+	{" +$", ""},
 }

 ignoredInvalidStats = {
diff --git a/WeightsWatcher.lua b/WeightsWatcher.lua
index c433cdc..6072b8a 100644
--- a/WeightsWatcher.lua
+++ b/WeightsWatcher.lua
@@ -1045,7 +1045,8 @@ function WeightsWatcher.getItemStats(link)
 end

 function WeightsWatcher.preprocess(text)
-	for pattern, replacement in pairs(Preprocess) do
+	for _, regex in ipairs(Preprocess) do
+		local pattern, replacement = unpack(regex)
 		if string.find(text, pattern) then
 			text = string.gsub(text, pattern, replacement)
 		end