Mercurial > prosody-hg
comparison core/moduleapi.lua @ 7115:805d068d2fd5
modulemanager, util.pluginloader: Move logic for locating some module libraries to pluginloader, to fix problems with non-filesystem errors being masked by the second load_code call
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Mon, 01 Feb 2016 21:26:15 +0000 |
| parents | 6236668da30a |
| children | ecba5fee4867 27557dd7b460 |
comparison
equal
deleted
inserted
replaced
| 7114:51cf09bb74eb | 7115:805d068d2fd5 |
|---|---|
| 133 function api:wrap_global(event, handler) | 133 function api:wrap_global(event, handler) |
| 134 return self:hook_object_event(prosody.events, event, handler); | 134 return self:hook_object_event(prosody.events, event, handler); |
| 135 end | 135 end |
| 136 | 136 |
| 137 function api:require(lib) | 137 function api:require(lib) |
| 138 local f, n = pluginloader.load_code(self.name, lib..".lib.lua", self.environment); | 138 local f, n = pluginloader.load_code_ext(self.name, lib, "lib.lua", self.environment); |
| 139 if not f then | |
| 140 f, n = pluginloader.load_code(lib, lib..".lib.lua", self.environment); | |
| 141 end | |
| 142 if not f then error("Failed to load plugin library '"..lib.."', error: "..n); end -- FIXME better error message | 139 if not f then error("Failed to load plugin library '"..lib.."', error: "..n); end -- FIXME better error message |
| 143 return f(); | 140 return f(); |
| 144 end | 141 end |
| 145 | 142 |
| 146 function api:depends(name) | 143 function api:depends(name) |
