Software /
code /
prosody
Comparison
core/modulemanager.lua @ 778:0d94b4903cc7
modulemanager initializes hosts[host] if it isn't already initialized when loading a module.
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Wed, 11 Feb 2009 17:57:48 +0500 |
parent | 769:9e76018c62fa |
child | 876:fad020cead52 |
comparison
equal
deleted
inserted
replaced
777:f7a87acea220 | 778:0d94b4903cc7 |
---|---|
110 local api_instance = setmetatable({ name = module_name, host = host, config = config, _log = _log, log = function (self, ...) return _log(...); end }, { __index = api }); | 110 local api_instance = setmetatable({ name = module_name, host = host, config = config, _log = _log, log = function (self, ...) return _log(...); end }, { __index = api }); |
111 | 111 |
112 local pluginenv = setmetatable({ module = api_instance }, { __index = _G }); | 112 local pluginenv = setmetatable({ module = api_instance }, { __index = _G }); |
113 | 113 |
114 setfenv(mod, pluginenv); | 114 setfenv(mod, pluginenv); |
115 if not hosts[host] then hosts[host] = { type = "component", host = host, connected = false, s2sout = {} }; end | |
115 | 116 |
116 local success, ret = pcall(mod); | 117 local success, ret = pcall(mod); |
117 if not success then | 118 if not success then |
118 log("error", "Error initialising module '%s': %s", name or "nil", ret or "nil"); | 119 log("error", "Error initialising module '%s': %s", name or "nil", ret or "nil"); |
119 return nil, ret; | 120 return nil, ret; |