From dad6d3d2187128cedf98fb4253f11da9ed39797a Mon Sep 17 00:00:00 2001 From: takase1121 <20792268+takase1121@users.noreply.github.com> Date: Tue, 22 Jun 2021 09:18:40 +0800 Subject: [PATCH] fix undefined variable --- data/core/init.lua | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/data/core/init.lua b/data/core/init.lua index eb914803..369a3acf 100644 --- a/data/core/init.lua +++ b/data/core/init.lua @@ -690,15 +690,13 @@ function core.load_plugins() local version_match = check_plugin_version(plugin_dir .. '/' .. filename) if not version_match then core.log_quiet("Version mismatch for plugin %q from %s", basename, plugin_dir) - local ls = refused_list[root_dir == USERDIR and 'userdir' or 'datadir'].plugins - ls[#ls + 1] = filename + local list = refused_list[plugin_dir:find(USERDIR) == 1 and 'userdir' or 'datadir'].plugins + table.insert(list, filename) end - if version_match and config[basename] ~= false then - local modname = "plugins." .. basename - local ok = core.try(require, modname) - if ok then core.log_quiet("Loaded plugin %q from %s", basename, plugin_dir) end - if not ok then - no_errors = false + if version_match and core[basename] ~= false then + no_errors = core.try(require, "plugins." .. basename) + if no_errors then + core.log_quiet("Loaded plugin %q from %s", basename, plugin_dir) end end end