Simplified singleStat slightly
Kevin Lyles [09-17-09 - 03:57]
Simplified singleStat slightly
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