From edcba96c0088210927558b0e2583f3b689f457c4 Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Sun, 24 Sep 2023 23:13:51 +0200 Subject: 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 Co-authored-by: zeertzjq --- src/if_lua.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/if_lua.c') diff --git a/src/if_lua.c b/src/if_lua.c index 2041f5bccc..65d265f388 100644 --- a/src/if_lua.c +++ b/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 -- cgit v1.2.3