From 7f33c1967b78ca8fda11fb0ad4c7f57d563e6ede Mon Sep 17 00:00:00 2001 From: Tyler Miller Date: Wed, 3 Jul 2024 15:36:00 -0700 Subject: fix(lua): use rawget() to get __call in vim.is_callable() (#29536) Lua 5.1 uses a "raw get" to retrieve `__call` from a metatable to determine if a table is callable. Mirror this behavior in `vim.is_callable()`. --- runtime/lua/vim/shared.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/lua/vim/shared.lua') diff --git a/runtime/lua/vim/shared.lua b/runtime/lua/vim/shared.lua index 621de2b1c2..99530bf72e 100644 --- a/runtime/lua/vim/shared.lua +++ b/runtime/lua/vim/shared.lua @@ -997,7 +997,7 @@ function vim.is_callable(f) if m == nil then return false end - return type(m.__call) == 'function' + return type(rawget(m, '__call')) == 'function' end --- Creates a table whose missing keys are provided by {createfn} (like Python's "defaultdict"). -- cgit