1
0
forked from aniani/vim

patch 9.0.1933: Can change the type of a v: variable using if_lua

Problem:  Can change the type of a v: variable using if_lua.
Solution: Add additional handling of v: variables like :let.

closes: #13161

Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
This commit is contained in:
zeertzjq
2023-09-24 23:13:51 +02:00
committed by Christian Brabandt
parent 7398f367d5
commit edcba96c00
6 changed files with 117 additions and 62 deletions

View File

@@ -1900,6 +1900,16 @@ luaV_setvar(lua_State *L)
}
else
{
int type_error = FALSE;
if (dict == get_vimvar_dict()
&& !before_set_vvar((char_u *)name, di, &tv, TRUE, &type_error))
{
clear_tv(&tv);
if (type_error)
return luaL_error(L,
"Setting v:%s to value with wrong type", name);
return 0;
}
// Clear the old value
clear_tv(&di->di_tv);
// Update the value