diff options
author | Matthew Wild <mwild1@gmail.com> | 2025-01-09 16:44:48 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2025-01-09 16:44:48 +0000 |
commit | bde66f94368629713c4a35dc1326f4de54ddf3da (patch) | |
tree | ddb089778c3a71b6056e24ef458f8ce6dbe5f54e | |
parent | f6ed03a903a23b9f11c00ff865b8fb82f50b8303 (diff) | |
download | prosody-bde66f94368629713c4a35dc1326f4de54ddf3da.tar.gz prosody-bde66f94368629713c4a35dc1326f4de54ddf3da.zip |
modulemanager: Allow modules to specify supported Lua versions in metadata
-rw-r--r-- | core/modulemanager.lua | 14 |
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); |