Mercurial > prosody-hg
comparison core/modulemanager.lua @ 2584:5091548a3805
modulemanager: Make the plugin environment available directly (module.environment within plugins).
| author | Waqas Hussain <waqas20@gmail.com> |
|---|---|
| date | Thu, 11 Feb 2010 05:34:53 +0500 |
| parents | 9c074ba1f662 |
| children | a9e99897b2e8 |
comparison
equal
deleted
inserted
replaced
| 2583:cb1f9266130b | 2584:5091548a3805 |
|---|---|
| 125 | 125 |
| 126 local _log = logger.init(host..":"..module_name); | 126 local _log = logger.init(host..":"..module_name); |
| 127 local api_instance = setmetatable({ name = module_name, host = host, config = config, _log = _log, log = function (self, ...) return _log(...); end }, { __index = api }); | 127 local api_instance = setmetatable({ name = module_name, host = host, config = config, _log = _log, log = function (self, ...) return _log(...); end }, { __index = api }); |
| 128 | 128 |
| 129 local pluginenv = setmetatable({ module = api_instance }, { __index = _G }); | 129 local pluginenv = setmetatable({ module = api_instance }, { __index = _G }); |
| 130 api_instance.environment = pluginenv; | |
| 130 | 131 |
| 131 setfenv(mod, pluginenv); | 132 setfenv(mod, pluginenv); |
| 132 if not hosts[host] then | 133 if not hosts[host] then |
| 133 local create_component = _G.require "core.componentmanager".create_component; | 134 local create_component = _G.require "core.componentmanager".create_component; |
| 134 hosts[host] = create_component(host); | 135 hosts[host] = create_component(host); |
