From 4dcc49be8ec6bc080c91a0fcce1879736750ae73 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Wed, 24 Nov 2010 19:20:07 +0000 Subject: tab vs space git-svn-id: https://svn.spreadspace.org/gcsd/trunk@60 ac14a137-c7f1-4531-abe0-07747231d213 --- examples/simple_dispatcher.lua | 10 +++++----- src/dispatch_table.lua | 22 +++++++++++----------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/examples/simple_dispatcher.lua b/examples/simple_dispatcher.lua index 5a931e3..4c935fe 100644 --- a/examples/simple_dispatcher.lua +++ b/examples/simple_dispatcher.lua @@ -1,6 +1,6 @@ return { - ["%w+%s*"] = function(match) - local cmd = string.match("(%w+)%s*", match) - command_queue:enqueue_command(cmd) - end -} \ No newline at end of file + ["%w+%s*\n"] = function(match) + local cmd = string.match("(%w+)%s*", match) + command_queue:enqueue_command(cmd) + end +} diff --git a/src/dispatch_table.lua b/src/dispatch_table.lua index 912394a..7783113 100644 --- a/src/dispatch_table.lua +++ b/src/dispatch_table.lua @@ -39,13 +39,13 @@ function dispatch_table:load_handler_table_file(filename) local defines = require('defines') if (type(filename) ~= "nil") then if (type(filename) ~= "string") then - log.printf(log.ERROR, "filename must be of type 'string' and denote a valid path") - return defines.KILL_DAEMON + log.printf(log.ERROR, "filename must be of type 'string' and denote a valid path") + return defines.KILL_DAEMON end local chunk = loadfile(filename) if (not chunk) then - log.printf(log.ERROR, "failed to load lua-file '%s'", filename) - return defines.KILL_DAEMON + log.printf(log.ERROR, "failed to load lua-file '%s'", filename) + return defines.KILL_DAEMON end self:register_handler_table(chunk()) log.printf(log.NOTICE, "loaded dispatch table from file %s", filename) @@ -65,13 +65,13 @@ function dispatch_table:dispatch(command_buffer) 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) - had_match = true - init = init + string.len(match) - break - end + local match = string.match(command_buffer, "^" .. regex, init) + if match then + handler(match) + had_match = true + init = init + string.len(match) + break + end end until (not had_match) -- cgit v1.2.3