core/modulemanager.lua

changeset 3620
bfc47564aaef
parent 3608
ae0f83feaff4
child 3623
6f4db418a9cc
equal deleted inserted replaced
3619:291ae816d800 3620:bfc47564aaef
115 local _log = logger.init(host..":"..module_name); 115 local _log = logger.init(host..":"..module_name);
116 local api_instance = setmetatable({ name = module_name, host = host, config = config, _log = _log, log = function (self, ...) return _log(...); end }, { __index = api }); 116 local api_instance = setmetatable({ name = module_name, host = host, config = config, _log = _log, log = function (self, ...) return _log(...); end }, { __index = api });
117 117
118 local pluginenv = setmetatable({ module = api_instance }, { __index = _G }); 118 local pluginenv = setmetatable({ module = api_instance }, { __index = _G });
119 api_instance.environment = pluginenv; 119 api_instance.environment = pluginenv;
120 pluginenv._M = pluginenv;
120 121
121 setfenv(mod, pluginenv); 122 setfenv(mod, pluginenv);
122 hosts[host].modules = modulemap[host]; 123 hosts[host].modules = modulemap[host];
123 modulemap[host][module_name] = pluginenv; 124 modulemap[host][module_name] = pluginenv;
124 125

mercurial