fix(lua): show error message when failing to set variable (#25321)

This commit is contained in:
zeertzjq
2023-09-23 15:59:37 +08:00
committed by GitHub
parent c0a29931e2
commit 5331d5772f
3 changed files with 8 additions and 0 deletions

View File

@@ -359,6 +359,9 @@ int nlua_setvar(lua_State *lstate)
Error err = ERROR_INIT;
dictitem_T *di = dict_check_writable(dict, key, del, &err);
if (ERROR_SET(&err)) {
nlua_push_errstr(lstate, "%s", err.msg);
api_clear_error(&err);
lua_error(lstate);
return 0;
}