aboutsummaryrefslogtreecommitdiffstats
path: root/loader.lua
diff options
context:
space:
mode:
Diffstat (limited to 'loader.lua')
-rw-r--r--loader.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/loader.lua b/loader.lua
index ddd25a82..9c2176a7 100644
--- a/loader.lua
+++ b/loader.lua
@@ -19,3 +19,17 @@ else
end)
end
end
+
+-- Look for already loaded module with or without prefix
+setmetatable(package.loaded, {
+ __index = function(loaded, module_name)
+ local suffix = module_name:match("^prosody%.(.*)$");
+ if suffix then
+ return rawget(loaded, suffix);
+ end
+ local prefixed = rawget(loaded, "prosody." .. module_name);
+ if prefixed ~= nil then
+ return prefixed;
+ end
+ end;
+})