Changeset

11129:387d442497e7

util.pluginloader: Extract Lua version once It's not going to change while the module is loaded.
author Kim Alvefur <zash@zash.se>
date Mon, 05 Oct 2020 20:56:03 +0200
parents 11127:1d9cd1abc660
children 11130:10485a3ef78b
files util/pluginloader.lua
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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