# HG changeset patch # User Matthew Wild # Date 1736441088 0 # Node ID b03b5716e4cf7d3c569be084e49182bbd396b334 # Parent 601ec2c19180a9a7dbe860f26bc460bc08692e1d modulemanager: Allow modules to specify supported Lua versions in metadata diff -r 601ec2c19180 -r b03b5716e4cf core/modulemanager.lua --- a/core/modulemanager.lua Thu Jan 09 16:06:53 2025 +0000 +++ b/core/modulemanager.lua Thu Jan 09 16:44:48 2025 +0000 @@ -66,6 +66,20 @@ 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);