Mercurial > prosody-hg
comparison core/modulemanager.lua @ 4182:f71e66702665
modulemanager: Added module.path to the plugin API to let plugins determine their load path.
| author | Waqas Hussain <waqas20@gmail.com> |
|---|---|
| date | Sun, 20 Feb 2011 20:06:38 +0500 |
| parents | 9dfb3c0101b5 |
| children | a2ee8ab82dd9 |
comparison
equal
deleted
inserted
replaced
| 4181:2f4496f46da2 | 4182:f71e66702665 |
|---|---|
| 115 log("error", "Unable to load module '%s': %s", module_name or "nil", err or "nil"); | 115 log("error", "Unable to load module '%s': %s", module_name or "nil", err or "nil"); |
| 116 return nil, err; | 116 return nil, err; |
| 117 end | 117 end |
| 118 | 118 |
| 119 local _log = logger.init(host..":"..module_name); | 119 local _log = logger.init(host..":"..module_name); |
| 120 local api_instance = setmetatable({ name = module_name, host = host, config = config, _log = _log, log = function (self, ...) return _log(...); end }, { __index = api }); | 120 local api_instance = setmetatable({ name = module_name, host = host, path = err, config = config, _log = _log, log = function (self, ...) return _log(...); end }, { __index = api }); |
| 121 | 121 |
| 122 local pluginenv = setmetatable({ module = api_instance }, { __index = _G }); | 122 local pluginenv = setmetatable({ module = api_instance }, { __index = _G }); |
| 123 api_instance.environment = pluginenv; | 123 api_instance.environment = pluginenv; |
| 124 | 124 |
| 125 setfenv(mod, pluginenv); | 125 setfenv(mod, pluginenv); |
