This commit is contained in:
Bunny67
2020-07-26 14:29:54 +03:00
parent 368a646da5
commit 0dfc91e3a3
6 changed files with 20 additions and 33 deletions
+6 -16
View File
@@ -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