famiu/bufdelete.nvim

[Bug] bad argument #1 to 'ipairs' (table expected, got number)

barklan opened this issue · 3 comments

Neovim version

NVIM v0.9.1
Build type: Release
LuaJIT 2.1.0-beta3

Describe the bug

After commits 3d34816 - 42ccf4f

E5108: Error executing lua: ...al/share/nvim/lazy/bufdelete.nvim/lua/bufdelete/init.lua:192: bad argument #1 to 'ipairs' (table expected, got number)
stack traceback:
        [C]: in function 'ipairs'
        ...al/share/nvim/lazy/bufdelete.nvim/lua/bufdelete/init.lua:192: in function 'get_target_buffers'
        ...al/share/nvim/lazy/bufdelete.nvim/lua/bufdelete/init.lua:205: in function 'bufdelete'
        /home/barklan/.config/nvim/lua/config/keymaps_nvim.lua:17: in function </home/barklan/.config/nvim/lua/config/keymaps_nvim.lua:3>

To Reproduce

require('bufdelete').bufdelete(0)

Expected behavior

Delete current buffer

Calling with a table (require('bufdelete').bufdelete({0}) produces this:

E5108: Error executing lua: ...al/share/nvim/lazy/bufdelete.nvim/lua/bufdelete/init.lua:134: Vim:E516: No buffers were deleted
stack traceback:
        [C]: in function 'bdelete'
        ...al/share/nvim/lazy/bufdelete.nvim/lua/bufdelete/init.lua:134: in function 'buf_kill'
        ...al/share/nvim/lazy/bufdelete.nvim/lua/bufdelete/init.lua:205: in function 'bufdelete'
        /home/barklan/.config/nvim/lua/config/keymaps_nvim.lua:17: in function </home/barklan/.config/nvim/lua/config/keymaps_nvim.lua:3>
Zeioth commented

Seems to be broken: Calling it as described in the documentation.

require("bufdelete").bufdelete(0, true) -- Says arg 1 should be a table
require("bufdelete").bufdelete({0}, true) -- But passing a table Vim:E516: No buffers were deleted
famiu commented

Should be fixed now with the latest commit