Comparison

plugins/mod_console.lua @ 444:77485b9b840c

Add module:unload() to mod_console, and allow module:load() to take config param
author Matthew Wild <mwild1@gmail.com>
date Thu, 27 Nov 2008 23:36:17 +0000
parent 440:dee02bf4656a
child 461:8e66201f566a
comparison
equal deleted inserted replaced
443:bd1397b1dfc9 444:77485b9b840c
127 dofile "main.lua" 127 dofile "main.lua"
128 return true, "Server reloaded"; 128 return true, "Server reloaded";
129 end 129 end
130 130
131 def_env.module = {}; 131 def_env.module = {};
132 function def_env.module:load(name, host) 132 function def_env.module:load(name, host, config)
133 local mm = require "modulemanager"; 133 local mm = require "modulemanager";
134 local ok, err = mm.load(host or self.env.host, name); 134 local ok, err = mm.load(host or self.env.host, name, config);
135 if not ok then 135 if not ok then
136 return false, err or "Unknown error loading module"; 136 return false, err or "Unknown error loading module";
137 end 137 end
138 return true, "Module loaded"; 138 return true, "Module loaded";
139 end
140
141 function def_env.module:unload(name, host)
142 local mm = require "modulemanager";
143 local ok, err = mm.unload(host or self.env.host, name);
144 if not ok then
145 return false, err or "Unknown error unloading module";
146 end
147 return true, "Module unloaded";
139 end 148 end
140 149
141 def_env.config = {}; 150 def_env.config = {};
142 function def_env.config:load(filename, format) 151 function def_env.config:load(filename, format)
143 local config_load = require "core.configmanager".load; 152 local config_load = require "core.configmanager".load;