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:
committed by
Christian Brabandt
parent
7398f367d5
commit
edcba96c00
10
src/if_lua.c
10
src/if_lua.c
@@ -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
|
||||
|
Reference in New Issue
Block a user