diff options
Diffstat (limited to 'core/modulemanager.lua')
-rw-r--r-- | core/modulemanager.lua | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/core/modulemanager.lua b/core/modulemanager.lua index 873e08e5..b8ba2f35 100644 --- a/core/modulemanager.lua +++ b/core/modulemanager.lua @@ -26,7 +26,7 @@ local xpcall = require "prosody.util.xpcall".xpcall; local debug_traceback = debug.traceback; local setmetatable, rawget = setmetatable, rawget; local ipairs, pairs, type, t_insert = ipairs, pairs, type, table.insert; -local lua_version = _VERSION:match("5%.%d$"); +local lua_version = _VERSION:match("5%.%d+$"); local autoload_modules = { prosody.platform, @@ -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); |