From 082c221f9b396310b7adb57e99aa00ae5f24732a Mon Sep 17 00:00:00 2001 From: Kevin Lyles Date: Wed, 16 Sep 2009 22:57:37 -0500 Subject: [PATCH] Simplified singleStat slightly --- Regexps.lua | 12 ++++-------- WeightsWatcher.lua | 4 ++-- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/Regexps.lua b/Regexps.lua index 54f89e9..18e5be4 100644 --- a/Regexps.lua +++ b/Regexps.lua @@ -115,8 +115,8 @@ function multipleStats(text) text = string.gsub(string.gsub(text, ",? and ", "\a"), ", ", "\a") stringTable = { strsplit("\a", text) } for _, statString in pairs(stringTable) do - valid, stat = extractSingleStat(statString) - if valid then + stat = singleStat(statString) + if stat then table.insert(stats, stat) end end @@ -147,7 +147,7 @@ function damageRange(textL, textR) end end -function extractSingleStat(text) +function singleStat(text) local stat for _, regex in pairs(SingleStatLines) do if type(regex) == "table" then @@ -166,11 +166,7 @@ function extractSingleStat(text) end end end - if stat then - return true, stat - else - return false - end + return stat end function singleStatValueOnly(text, pattern, name) diff --git a/WeightsWatcher.lua b/WeightsWatcher.lua index 1d79b9b..c76a744 100644 --- a/WeightsWatcher.lua +++ b/WeightsWatcher.lua @@ -126,8 +126,8 @@ function DisplayItemInfo(tooltip, ttname) end end if not matched then - matched, stat = extractSingleStat(textL) - if matched then + stat = singleStat(textL) + if stat then tooltip:AddDoubleLine(unpack(stat)) else for _, regex in pairs(ProcessedLines) do -- 1.7.9.5