# HG changeset patch # User Kim Alvefur # Date 1601924163 -7200 # Node ID 387d442497e7fd85913b5378be533740d1800f66 # Parent 1d9cd1abc6602844d8e430af36e40c418f2fe916 util.pluginloader: Extract Lua version once It's not going to change while the module is loaded. diff -r 1d9cd1abc660 -r 387d442497e7 util/pluginloader.lua --- a/util/pluginloader.lua Sat Oct 03 16:22:56 2020 +0200 +++ b/util/pluginloader.lua Mon Oct 05 20:56:03 2020 +0200 @@ -8,6 +8,7 @@ -- luacheck: ignore 113/CFG_PLUGINDIR local dir_sep, path_sep = package.config:match("^(%S+)%s(%S+)"); +local lua_version = _VERSION:match(" (.+)$"); local plugin_dir = {}; for path in (CFG_PLUGINDIR or "./plugins/"):gsub("[/\\]", dir_sep):gmatch("[^"..path_sep.."]+") do path = path..dir_sep; -- add path separator to path end @@ -36,7 +37,6 @@ local function load_resource(plugin, resource) resource = resource or "mod_"..plugin..".lua"; - local lua_version = _VERSION:match(" (.+)$"); local names = { "mod_"..plugin..dir_sep..plugin..dir_sep..resource; -- mod_hello/hello/mod_hello.lua "mod_"..plugin..dir_sep..resource; -- mod_hello/mod_hello.lua