diff options
author | Matthew Wild <mwild1@gmail.com> | 2012-04-27 21:37:45 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2012-04-27 21:37:45 +0100 |
commit | 0181e189a3dad8882b80d277476d781912807228 (patch) | |
tree | cbbd9c24da20e9c342ed87e94830c3106ed54987 /core/modulemanager.lua | |
parent | ecc47f29209c1d7d7e505ebf1de86355afc4937c (diff) | |
download | prosody-0181e189a3dad8882b80d277476d781912807228.tar.gz prosody-0181e189a3dad8882b80d277476d781912807228.zip |
modulemanager: Set module.environment before calling add_host, otherwise the module will get the parent's environment (thanks xnyhps and Maranda)
Diffstat (limited to 'core/modulemanager.lua')
-rw-r--r-- | core/modulemanager.lua | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/modulemanager.lua b/core/modulemanager.lua index bf1e1924..5a97e5bf 100644 --- a/core/modulemanager.lua +++ b/core/modulemanager.lua @@ -142,10 +142,10 @@ local function do_load_module(host, module_name) },{ __index = modulemap["*"][module_name].module; }); + local host_module = setmetatable({ module = host_module_api }, { __index = mod }); + host_module_api.environment = host_module; local ok, result, module_err = call_module_method(mod, "add_host", host_module_api); if not ok or result == false then return nil, ok and module_err or result; end - local host_module = setmetatable({ module = host_module_api }, { __index = mod }); - host_module.module.environment = host_module; modulemap[host][module_name] = host_module; return host_module; end |