diff options
Diffstat (limited to 'src/command_table.lua')
-rw-r--r-- | src/command_table.lua | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/command_table.lua b/src/command_table.lua index e747729..384ab50 100644 --- a/src/command_table.lua +++ b/src/command_table.lua @@ -32,10 +32,10 @@ command_table = {} command_table.regex_to_handler = { - ["%w+%s*\n"] = function(match) + ["%w+%s*\n"] = function(match, requester) command_queue:enqueue(string.match(match , "(%w+)%s*")) end, - [".*\n"] = function(match) end + [".*\n"] = function(match, requester) end } function command_table:register_handler_table(handler_table) @@ -46,14 +46,14 @@ function command_table:register_handler_table(handler_table) log.printf(log.DEBUG, "loaded new command handler table") end -function command_table:dispatch(command_buffer) +function command_table:dispatch(command_buffer, requester) local init = 1 repeat local had_match = false for regex, handler in pairs(self.regex_to_handler) do local match = string.match(command_buffer, "^" .. regex, init) if match then - handler(match) + handler(match, requester) had_match = true init = init + string.len(match) break |