mirror of
https://github.com/neovim/neovim
synced 2025-07-16 01:01:49 +00:00
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()`.
This commit is contained in:
@ -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").
|
||||
|
Reference in New Issue
Block a user