Commit cb79c62c authored by Ivaria's avatar Ivaria

Slash command arguments can now be properly quoted

parent 81185938
......@@ -311,7 +311,7 @@ function VUHDO_textParse(aString)
aString = gsub(aString, " ", " ");
end
return VUHDO_splitString(aString, " ");
return VUHDO_splitStringQuoted(aString);
end
......@@ -337,6 +337,39 @@ end
function VUHDO_splitStringQuoted(aText)
local tSplit = {};
local tPrevToken, tQuoteToken;
for tToken in string.gmatch(aText, "%S+") do
local tStartQuote = string.match(tToken, [[^(['"])]]);
local tEndQuote = string.match(tToken, [[(['"])$]]);
if tStartQuote and not tEndQuote and not tQuoteToken then
tPrevToken = tToken;
tQuoteToken = tStartQuote;
elseif tPrevToken and tQuoteToken == tEndQuote then
tToken = tPrevToken .. ' ' .. tToken;
tPrevToken = nil;
tQuoteToken = nil;
elseif tPrevToken then
tPrevToken = tPrevToken .. ' ' .. tToken;
end
if not tPrevToken then
tToken = string.gsub(tToken, [[^(['"])]], "");
tToken = string.gsub(tToken, [[(['"])$]], "");
table.insert(tSplit, tToken);
end
end
return tSplit;
end
-- returns true if player currently is in a battleground
local tType;
function VUHDO_isInBattleground()
......
......@@ -10,6 +10,7 @@ Known issues:
Bugfixes:
-- Slash command arguments can now be properly quoted
Improvements:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment