# HG changeset patch # User Matthew Wild # Date 1233194291 0 # Node ID 40837f3422abcba1373790bfae21b4d56f339fa2 # Parent 7027de4c039dc09cf963c7dbdfd151015bc5cb05 modulemanager: Add get_host_type() API method, and fix up call_module_method to work properly diff -r 7027de4c039d -r 40837f3422ab core/modulemanager.lua --- a/core/modulemanager.lua Sat Jan 24 20:29:25 2009 +0000 +++ b/core/modulemanager.lua Thu Jan 29 01:58:11 2009 +0000 @@ -29,6 +29,8 @@ 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 @@ 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 @@ return self.host; end +function api:get_host_type() + return hosts[self.host].type; +end + function api:set_global() self.host = "*"; end