From 264fbc0ace0b701ac6fa8fe217d42950c8fd79c3 Mon Sep 17 00:00:00 2001 From: Yi Ming Date: Wed, 6 May 2026 04:32:20 +0800 Subject: 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`. --- runtime/lua/vim/_core/shared.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'runtime/lua/vim/_core') 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]]) do - if t[j] == nil then + if rawget(t, j) == nil then return false end j = j + 1 -- cgit