Comparison

plugins/mod_console.lua @ 2253:a3537266a916

mod_console: Update for new server API, fixes traceback when closing console sessions
author Matthew Wild <mwild1@gmail.com>
date Sat, 28 Nov 2009 17:39:05 +0000
parent 2145:daeb6ebf304c
child 2296:23e84604fb00
comparison
equal deleted inserted replaced
2252:98a2bc275e0e 2253:a3537266a916
35 function console:new_session(conn) 35 function console:new_session(conn)
36 local w = function(s) conn:write(s:gsub("\n", "\r\n")); end; 36 local w = function(s) conn:write(s:gsub("\n", "\r\n")); end;
37 local session = { conn = conn; 37 local session = { conn = conn;
38 send = function (t) w(tostring(t)); end; 38 send = function (t) w(tostring(t)); end;
39 print = function (t) w("| "..tostring(t).."\n"); end; 39 print = function (t) w("| "..tostring(t).."\n"); end;
40 disconnect = function () conn.close(); end; 40 disconnect = function () conn:close(); end;
41 }; 41 };
42 session.env = setmetatable({}, default_env_mt); 42 session.env = setmetatable({}, default_env_mt);
43 43
44 -- Load up environment with helper objects 44 -- Load up environment with helper objects
45 for name, t in pairs(def_env) do 45 for name, t in pairs(def_env) do