mod_console: Added support for multiple arguments to print().
authorWaqas Hussain <waqas20@gmail.com>
Sun, 25 Jul 2010 19:59:26 +0000 (00:59 +0500)
committerWaqas Hussain <waqas20@gmail.com>
Sun, 25 Jul 2010 19:59:26 +0000 (00:59 +0500)
plugins/mod_console.lua

index e87ef536158cf39afb295406fcd929cdcc6dfa5a..20d04afe2f913e1b30c3d266c9c9cd74c79f96f9 100644 (file)
@@ -36,7 +36,13 @@ function console:new_session(conn)
        local w = function(s) conn:write(s:gsub("\n", "\r\n")); end;
        local session = { conn = conn;
                        send = function (t) w(tostring(t)); end;
-                       print = function (t) w("| "..tostring(t).."\n"); end;
+                       print = function (...)
+                               local t = {};
+                               for i=1,select("#", ...) do
+                                       t[i] = tostring(select(i, ...));
+                               end
+                               w("| "..table.concat(t, "\t").."\n");
+                       end;
                        disconnect = function () conn:close(); end;
                        };
        session.env = setmetatable({}, default_env_mt);