Mercurial > prosody-hg
comparison core/modulemanager.lua @ 2585:a9e99897b2e8
modulemanager: Load plugin libraries in the same environment as the plugins.
| author | Waqas Hussain <waqas20@gmail.com> |
|---|---|
| date | Thu, 11 Feb 2010 05:36:03 +0500 |
| parents | 5091548a3805 |
| children | ba6dd11f7259 |
comparison
equal
deleted
inserted
replaced
| 2584:5091548a3805 | 2585:a9e99897b2e8 |
|---|---|
| 396 local f, n = pluginloader.load_code(self.name, lib..".lib.lua"); | 396 local f, n = pluginloader.load_code(self.name, lib..".lib.lua"); |
| 397 if not f then | 397 if not f then |
| 398 f, n = pluginloader.load_code(lib, lib..".lib.lua"); | 398 f, n = pluginloader.load_code(lib, lib..".lib.lua"); |
| 399 end | 399 end |
| 400 if not f then error("Failed to load plugin library '"..lib.."', error: "..n); end -- FIXME better error message | 400 if not f then error("Failed to load plugin library '"..lib.."', error: "..n); end -- FIXME better error message |
| 401 setfenv(f, setmetatable({ module = self }, { __index = _G })); | 401 setfenv(f, self.environment); |
| 402 return f(); | 402 return f(); |
| 403 end | 403 end |
| 404 | 404 |
| 405 function api:get_option(name, default_value) | 405 function api:get_option(name, default_value) |
| 406 local value = config.get(self.host, self.name, name); | 406 local value = config.get(self.host, self.name, name); |
