From 753ba4a8f2dbb2fe7d25121fafa28180ea3d6972 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Mon, 5 Oct 2020 20:56:03 +0200 Subject: util.pluginloader: Extract Lua version once It's not going to change while the module is loaded. --- util/pluginloader.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'util/pluginloader.lua') diff --git a/util/pluginloader.lua b/util/pluginloader.lua index af0428c4..1cebe436 100644 --- a/util/pluginloader.lua +++ b/util/pluginloader.lua @@ -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 @@ end 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 -- cgit v1.2.3