diff options
| author | Yi Ming <ofseed@foxmail.com> | 2026-05-06 04:32:20 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-05-05 16:32:20 -0400 |
| commit | 264fbc0ace0b701ac6fa8fe217d42950c8fd79c3 (patch) | |
| tree | 5272f66e2c2f0c70aebd7f8b113782228330b21e /runtime/lua/vim | |
| parent | b1ebf45a6d251fc81446fa21d9b2bf25bcc87c5e (diff) | |
| download | rneovim-264fbc0ace0b701ac6fa8fe217d42950c8fd79c3.tar.gz rneovim-264fbc0ace0b701ac6fa8fe217d42950c8fd79c3.tar.bz2 rneovim-264fbc0ace0b701ac6fa8fe217d42950c8fd79c3.zip | |
fix(lua): avoid `__index` when deciding if a table is a list #39556
Problem:
When a table has `__index`, `vim.islist` is unreliable.
Solution:
Index using `rawget`.
Diffstat (limited to 'runtime/lua/vim')
| -rw-r--r-- | runtime/lua/vim/_core/shared.lua | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/runtime/lua/vim/_core/shared.lua b/runtime/lua/vim/_core/shared.lua index 6df4c85ae7..893171e3a2 100644 --- a/runtime/lua/vim/_core/shared.lua +++ b/runtime/lua/vim/_core/shared.lua @@ -960,7 +960,7 @@ function vim.islist(t) for _ in pairs(t--[[@as table<any,any>]]) do - if t[j] == nil then + if rawget(t, j) == nil then return false end j = j + 1 |