Diff

core/modulemanager.lua @ 698:d8a678e40a0a

Add core.actions for managing server 'actions'; and make modulemanager register actions 'load' and 'unload'
author Matthew Wild <mwild1@gmail.com>
date Mon, 12 Jan 2009 04:05:10 +0000
parent 695:3384f2784795
child 709:8bb83563cb21
line wrap: on
line diff
--- a/core/modulemanager.lua	Mon Jan 12 04:02:29 2009 +0000
+++ b/core/modulemanager.lua	Mon Jan 12 04:05:10 2009 +0000
@@ -27,7 +27,7 @@
 local eventmanager = require "core.eventmanager";
 local config = require "core.configmanager";
 local multitable_new = require "util.multitable".new;
-
+local register_actions = require "core.actions".register;
 
 local loadfile, pcall = loadfile, pcall;
 local setmetatable, setfenv, getfenv = setmetatable, setfenv, getfenv;
@@ -254,4 +254,17 @@
 
 --------------------------------------------------------------------
 
+local actions = {};
+
+function actions.load(params)
+	--return true, "Module loaded ("..params.module.." on "..params.host..")";
+	return load(params.host, params.module);
+end
+
+function actions.unload(params)
+	return unload(params.host, params.module);
+end
+
+register_actions("/modules", actions);
+
 return _M;