Software /
code /
prosody
Comparison
core/modulemanager.lua @ 4652:9d24bc503621
modulemanager: For children of shared modules, set module.environment to the empty environment for that module (useful to expose data or APIs at host.modules[module])
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sat, 21 Apr 2012 22:53:22 +0100 |
parent | 4643:9008fc396fb1 |
child | 4662:105423f77d46 |
comparison
equal
deleted
inserted
replaced
4651:d1739d72100a | 4652:9d24bc503621 |
---|---|
142 __index = modulemap["*"][module_name].module; | 142 __index = modulemap["*"][module_name].module; |
143 }); | 143 }); |
144 local ok, result, module_err = call_module_method(mod, "add_host", host_module_api); | 144 local ok, result, module_err = call_module_method(mod, "add_host", host_module_api); |
145 if not ok or result == false then return nil, ok and module_err or result; end | 145 if not ok or result == false then return nil, ok and module_err or result; end |
146 local host_module = setmetatable({ module = host_module_api }, { __index = mod }); | 146 local host_module = setmetatable({ module = host_module_api }, { __index = mod }); |
147 host_module.module.environment = host_module; | |
147 modulemap[host][module_name] = host_module; | 148 modulemap[host][module_name] = host_module; |
148 return host_module; | 149 return host_module; |
149 end | 150 end |
150 return nil, "global-module-already-loaded"; | 151 return nil, "global-module-already-loaded"; |
151 end | 152 end |