From d9cf8c7f3074b2c0025d446a6b3b2b85fd821b01 Mon Sep 17 00:00:00 2001 From: Kevin Lyles Date: Thu, 18 Feb 2010 21:05:09 -0600 Subject: [PATCH] Moved multiple and single stat handling to a separate function --- WeightsWatcher.lua | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) 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) -- 1.7.9.5