Comparison

plugins/mod_console.lua @ 1506:2c8aa16b4f64

mod_console: Expose commands and environment table
author Matthew Wild <mwild1@gmail.com>
date Thu, 09 Jul 2009 14:41:56 +0100
parent 1503:5970e06d9335
child 1523:841d61be198f
comparison
equal deleted inserted replaced
1505:e19cb945c25b 1506:2c8aa16b4f64
21 local set, array = require "util.set", require "util.array"; 21 local set, array = require "util.set", require "util.array";
22 22
23 local commands = {}; 23 local commands = {};
24 local def_env = {}; 24 local def_env = {};
25 local default_env_mt = { __index = def_env }; 25 local default_env_mt = { __index = def_env };
26
27 prosody.console = { commands = commands, env = def_env };
26 28
27 local function redirect_output(_G, session) 29 local function redirect_output(_G, session)
28 return setmetatable({ print = session.print }, { __index = function (t, k) return rawget(_G, k); end, __newindex = function (t, k, v) rawset(_G, k, v); end }); 30 return setmetatable({ print = session.print }, { __index = function (t, k) return rawget(_G, k); end, __newindex = function (t, k, v) rawset(_G, k, v); end });
29 end 31 end
30 32