From 6057fe64c95a06c9c8e2901c89324f543b2a8730 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Thu, 29 Jan 2009 01:58:11 +0000 Subject: modulemanager: Add get_host_type() API method, and fix up call_module_method to work properly --- core/modulemanager.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'core/modulemanager.lua') diff --git a/core/modulemanager.lua b/core/modulemanager.lua index 5305e5c6..b0b2b636 100644 --- a/core/modulemanager.lua +++ b/core/modulemanager.lua @@ -29,6 +29,8 @@ local config = require "core.configmanager"; local multitable_new = require "util.multitable".new; local register_actions = require "core.actions".register; +local hosts = hosts; + local loadfile, pcall = loadfile, pcall; local setmetatable, setfenv, getfenv = setmetatable, setfenv, getfenv; local pairs, ipairs = pairs, ipairs; @@ -231,9 +233,9 @@ function module_has_method(module, method) return type(module.module[method]) == "function"; end -function call_module_method(module, func, ...) - local f = module.module[func]; +function call_module_method(module, method, ...) if module_has_method(module, method) then + local f = module.module[func]; return pcall(f, ...); else return false, "no-such-method"; @@ -259,6 +261,10 @@ function api:get_host() return self.host; end +function api:get_host_type() + return hosts[self.host].type; +end + function api:set_global() self.host = "*"; end -- cgit v1.2.3