core/modulemanager.lua

changeset 1231
6f251813f1e5
parent 1183
565e16ee0c74
child 1247
4721e4124692
--- a/core/modulemanager.lua	Sat May 30 02:06:04 2009 +0500
+++ b/core/modulemanager.lua	Sat May 30 17:35:32 2009 +0500
@@ -354,6 +354,14 @@
 	return eventmanager.fire_event(...);
 end
 
+function api:hook(event, handler)
+	if self.host ~= '*' then
+		hosts[self.host].events.add_handler(event, handler);
+	else
+		self:log("error", "Global module attempting to hook a host-specific event: %s", event);
+	end
+end
+
 --------------------------------------------------------------------
 
 local actions = {};

mercurial