Browse Source

Adjusted the command parser to be more friendly with quotes and spaces.

master
atom0s 8 years ago
parent
commit
b5845f2884
  1. 21
      repeater.lua

21
repeater.lua

@ -25,7 +25,7 @@ @@ -25,7 +25,7 @@
_addon.author = 'bluekirby';
_addon.name = 'repeater';
_addon.version = '3.0.0';
_addon.version = '3.0.1';
require 'common'
@ -47,6 +47,22 @@ function read_fps_divisor() -- borrowed from fps addon @@ -47,6 +47,22 @@ function read_fps_divisor() -- borrowed from fps addon
return ashita.memory.read_uint32(addr + 0x30);
end;
function quoted_concat(t, s, o)
if (o == nil) then return ''; end
if (o > #t) then return ''; end
local ret = '';
for x = o, #t do
local spaces = string.find(t[x], " ");
if (spaces) then
ret = ret .. string.format('"%s"%s', t[x], s);
else
ret = ret .. string.format('%s%s', t[x], s);
end
end
return ret;
end
ashita.register_event('load', function(cmd, nType)
__go = false;
__command = "";
@ -62,7 +78,8 @@ ashita.register_event('command', function(cmd, nType) @@ -62,7 +78,8 @@ ashita.register_event('command', function(cmd, nType)
elseif (#args < 2) then
return true;
elseif ((args[2] == 'set') and (#args >= 3)) then
__command = table.concat(args," ",3,#args);
__command = quoted_concat(args," ",3);
__command = string.trim(__command);
print ("Command to be repeated: " .. __command);
return true;
elseif (args[2] == 'start') then

Loading…
Cancel
Save