diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-09-24 23:13:51 +0200 |
---|---|---|
committer | Christian Brabandt <cb@256bit.org> | 2023-09-24 23:13:51 +0200 |
commit | edcba96c0088210927558b0e2583f3b689f457c4 (patch) | |
tree | 615328c8c06bfd48a79098e7045c3998856b2d7f /src/if_lua.c | |
parent | 7398f367d5125eedfb4058c63a5d167fe8601e3d (diff) |
patch 9.0.1933: Can change the type of a v: variable using if_luav9.0.1933
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>
Diffstat (limited to 'src/if_lua.c')
-rw-r--r-- | src/if_lua.c | 10 |
1 files changed, 10 insertions, 0 deletions
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 |