From 4af45234273a2ea6dcdea84bcd6e4e540ffefc39 Mon Sep 17 00:00:00 2001 From: Kevin Lyles Date: Fri, 8 Jan 2010 13:08:44 -0600 Subject: [PATCH] Changed preprocessing patterns to be used in a set order --- Regexps.lua | 6 +++--- WeightsWatcher.lua | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) 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 -- 1.7.9.5