From 804bd861a5c3b98f7bfea4d133365201e6252ef2 Mon Sep 17 00:00:00 2001 From: Dmitry Petrov Date: Wed, 5 Mar 2025 09:18:05 -0500 Subject: [PATCH] Move an upvalue check out of the closure returned by gen_check_closure() --- src/plugins/lua/settings.lua | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/plugins/lua/settings.lua b/src/plugins/lua/settings.lua index 51622fb91d..0f8e007237 100644 --- a/src/plugins/lua/settings.lua +++ b/src/plugins/lua/settings.lua @@ -617,6 +617,12 @@ end -- Used to create a checking closure: if value matches expected somehow, return true local function gen_check_closure(expected, check_func) + if not check_func then + check_func = function(a, b) + return a == b + end + end + return function(value) if not value then return false @@ -627,13 +633,6 @@ local function gen_check_closure(expected, check_func) end if value then - - if not check_func then - check_func = function(a, b) - return a == b - end - end - local ret if type(expected) == 'table' then ret = fun.any(function(d) -- 2.47.3