From bde66f94368629713c4a35dc1326f4de54ddf3da Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Thu, 9 Jan 2025 16:44:48 +0000 Subject: modulemanager: Allow modules to specify supported Lua versions in metadata --- core/modulemanager.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'core') 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); -- cgit v1.2.3