Skip to content

Problem with parsing Vimscript boolean variable to if_lua interface (v:true becomes 1 instead of true, v:false becomes 0 instead of false) #15994

@brianhuster

Description

@brianhuster

Steps to reproduce

Test 1

  1. A Vim >= 8.2 with has('lua') returns 1
  2. :let g:t1 = v:false
  3. :lua print(vim.g.t1) => returns 0 instead of false

Test 2
4. :lua vim.g.t2 = false
5. :lua print(vim.g.t2) => returns 0 instead of false, even though it was declared as false

Expected behaviour

The line 3 should returns false instead of 0
The line 5 should returns false instead of 0

Given that luaeval successfully convert Lua boolean to Vimscript boolean, I don't understand why vim.eval can't do the same.

Also, this problem doesn't happen in Neovim

Version of Vim

VIM - Vi IMproved 9.1 (2024 Jan 02, compiled Sep 25 2024 10:13:04) Included patches: 1-16, 647, 678, 697

Environment

Kubuntu 24.04.1

Logs and stack traces

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions