diff --git a/WeakAuras/Prototypes.lua b/WeakAuras/Prototypes.lua index e1afd62..3eaca64 100644 --- a/WeakAuras/Prototypes.lua +++ b/WeakAuras/Prototypes.lua @@ -5725,13 +5725,13 @@ WeakAuras.dynamic_texts = { return "" end - local remainingStr = ""; + local remainingStr = ""; if remaining == math.huge then - remainingStr = " "; + remainingStr = " "; elseif remaining > 60 then - remainingStr = string.format("%i:", math.floor(remaining / 60)); - remaining = remaining % 60; - remainingStr = remainingStr..string.format("%02i", remaining); + remainingStr = string.format("%i:", math.floor(remaining / 60)); + remaining = remaining % 60; + remainingStr = remainingStr..string.format("%02i", remaining); elseif remaining > 0 then if progressPrecision == 4 and remaining <= 3 then remainingStr = remainingStr..string.format("%.1f", remaining); @@ -5745,7 +5745,7 @@ WeakAuras.dynamic_texts = { remainingStr = remainingStr..string.format("%.".. progressPrecision .."f", remaining); end else - remainingStr = " "; + remainingStr = " "; end return remainingStr end @@ -5770,13 +5770,13 @@ WeakAuras.dynamic_texts = { if type(duration) ~= "number" then return "" end - local durationStr = ""; + local durationStr = ""; if math.abs(duration) == math.huge or tostring(duration) == "nan" then durationStr = " "; elseif duration > 60 then - durationStr = string.format("%i:", math.floor(duration / 60)); - duration = duration % 60; - durationStr = durationStr..string.format("%02i", duration); + durationStr = string.format("%i:", math.floor(duration / 60)); + duration = duration % 60; + durationStr = durationStr..string.format("%02i", duration); elseif duration > 0 then if totalPrecision == 4 and duration <= 3 then durationStr = durationStr..string.format("%.1f", duration); @@ -5790,7 +5790,7 @@ WeakAuras.dynamic_texts = { durationStr = durationStr..string.format("%."..totalPrecision.."f", duration); end else - durationStr = " "; + durationStr = " "; end return durationStr end diff --git a/WeakAuras/Transmission.lua b/WeakAuras/Transmission.lua index 9aa4791..0d4171c 100644 --- a/WeakAuras/Transmission.lua +++ b/WeakAuras/Transmission.lua @@ -1360,7 +1360,6 @@ function WeakAuras.MatchInfo(data, children, target) if childDiff then info.modified = info.modified + 1 info.diffs[newIndex] = childDiff - else end end end diff --git a/WeakAuras/WeakAuras.lua b/WeakAuras/WeakAuras.lua index f26e8ce..22146d5 100644 --- a/WeakAuras/WeakAuras.lua +++ b/WeakAuras/WeakAuras.lua @@ -103,7 +103,7 @@ end SLASH_WEAKAURAS1, SLASH_WEAKAURAS2 = "/weakauras", "/wa"; function SlashCmdList.WEAKAURAS(input) - local args, msg = {} + local args, msg = {}, nil for v in string.gmatch(input, "%S+") do if not msg then msg = v @@ -351,9 +351,7 @@ function WeakAuras.validate(input, default) for field, defaultValue in pairs(default) do if(type(defaultValue) == "table" and type(input[field]) ~= "table") then input[field] = {}; - elseif(input[field] == nil) then - input[field] = defaultValue; - elseif(type(input[field]) ~= type(defaultValue)) then + elseif(input[field] == nil) or (type(input[field]) ~= type(defaultValue)) then input[field] = defaultValue; end if(type(input[field]) == "table") then @@ -6462,13 +6460,8 @@ function WeakAuras.ReplacePlaceHolders(textStr, region, customFunc, useHiddenSta end end elseif state == 1 then -- Percent Start State - if char == 37 then - start = currentPos - elseif char == 123 then + if char == 123 then start = currentPos + 1 - elseif (char >= 48 and char <= 57) or (char >= 65 and char <= 90) or (char >= 97 and char <= 122) or char == 46 then - -- 0-9a-zA-Z or dot character - start = currentPos else start = currentPos end @@ -6480,6 +6473,7 @@ function WeakAuras.ReplacePlaceHolders(textStr, region, customFunc, useHiddenSta result = result .. ValueForSymbol(symbol, region, customFunc, regionState, regionStates, useHiddenStates, formatters) if char == 37 then + -- Do nothing else start = currentPos end @@ -6521,13 +6515,8 @@ function WeakAuras.ParseTextStr(textStr, symbolCallback) local char = string.byte(textStr, currentPos); if state == 0 then -- Normal State elseif state == 1 then -- Percent Start State - if char == 37 then - start = currentPos - elseif char == 123 then + if char == 123 then start = currentPos + 1 - elseif (char >= 48 and char <= 57) or (char >= 65 and char <= 90) or (char >= 97 and char <= 122) or char == 46 then - -- 0-9a-zA-Z or dot character - start = currentPos else start = currentPos end @@ -6538,6 +6527,7 @@ function WeakAuras.ParseTextStr(textStr, symbolCallback) local symbol = string.sub(textStr, start, currentPos - 1) symbolCallback(symbol) if char == 37 then + -- Do nothing else start = currentPos end diff --git a/WeakAurasOptions/Cache.lua b/WeakAurasOptions/Cache.lua index ee9d6a1..ce0e596 100644 --- a/WeakAurasOptions/Cache.lua +++ b/WeakAurasOptions/Cache.lua @@ -92,9 +92,7 @@ function spellCache.GetIcon(name) if (icons) then if (icons.spells) then for spellId, icon in pairs(icons.spells) do - if (not bestMatch) then - bestMatch = spellId - elseif(type(spellId) == "number" and IsSpellKnown(spellId)) then + if not bestMatch or (type(spellId) == "number" and IsSpellKnown(spellId)) then bestMatch = spellId end end diff --git a/WeakAurasOptions/RegionOptions/Text.lua b/WeakAurasOptions/RegionOptions/Text.lua index f5b197d..28da2d9 100644 --- a/WeakAurasOptions/RegionOptions/Text.lua +++ b/WeakAurasOptions/RegionOptions/Text.lua @@ -82,7 +82,7 @@ local function createOptions(id, data) local textJustify = "" if data.justify == "CENTER" then - + -- CENTER is default elseif data.justify == "LEFT" then textJustify = " " .. L["and aligned left"] elseif data.justify == "RIGHT" then diff --git a/WeakAurasOptions/SubRegionOptions/SubText.lua b/WeakAurasOptions/SubRegionOptions/SubText.lua index 4644f40..9fc535b 100644 --- a/WeakAurasOptions/SubRegionOptions/SubText.lua +++ b/WeakAurasOptions/SubRegionOptions/SubText.lua @@ -105,7 +105,7 @@ local function createOptions(parentData, data, index, subIndex) local textJustify = "" if data.text_justify == "CENTER" then - + -- CENTER is default elseif data.text_justify == "LEFT" then textJustify = " " .. L["and aligned left"] elseif data.text_justify == "RIGHT" then