aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2025-01-09 16:44:48 +0000
committerMatthew Wild <mwild1@gmail.com>2025-01-09 16:44:48 +0000
commitbde66f94368629713c4a35dc1326f4de54ddf3da (patch)
treeddb089778c3a71b6056e24ef458f8ce6dbe5f54e
parentf6ed03a903a23b9f11c00ff865b8fb82f50b8303 (diff)
downloadprosody-bde66f94368629713c4a35dc1326f4de54ddf3da.tar.gz
prosody-bde66f94368629713c4a35dc1326f4de54ddf3da.zip
modulemanager: Allow modules to specify supported Lua versions in metadata
-rw-r--r--core/modulemanager.lua14
1 files changed, 14 insertions, 0 deletions
diff --git a/core/modulemanager.lua b/core/modulemanager.lua
index 4dfe3805..b8ba2f35 100644
--- a/core/modulemanager.lua
+++ b/core/modulemanager.lua
@@ -66,6 +66,20 @@ local loader = pluginloader.init({
end
end
+ if metadata.lua then
+ local supported = false;
+ for supported_lua_version in metadata.lua:gmatch("[^, ]+") do
+ if supported_lua_version == lua_version then
+ supported = true;
+ break;
+ end
+ end
+ if not supported then
+ log("warn", "Not loading module, we have Lua %s but the module requires one of (%s): %s", lua_version, metadata.lua, path);
+ return; -- Don't load this module
+ end
+ end
+
if metadata.conflicts then
local conflicts_features = set.new(array.collect(metadata.conflicts:gmatch("[^, ]+")));
local conflicted_features = set.intersection(conflicts_features, core_features);