refactor(lua): use Arena when converting from lua stack to API args

and for return value of nlua_exec/nlua_call_ref, as this uses
the same family of functions.

NB: the handling of luaref:s is a bit of a mess.
add api_luarefs_free_XX functions as a stop-gap as refactoring
luarefs is a can of worms for another PR:s.

as a minor feature/bug-fix, nvim_buf_call and nvim_win_call now preserves
arbitrary return values.
This commit is contained in:
bfredl
2024-02-11 15:46:14 +01:00
parent 89135cff03
commit 0353dd3029
33 changed files with 318 additions and 230 deletions

View File

@@ -1644,7 +1644,7 @@ char *eval_map_expr(mapblock_T *mp, int c)
if (mp->m_luaref != LUA_NOREF) {
Error err = ERROR_INIT;
Array args = ARRAY_DICT_INIT;
Object ret = nlua_call_ref(mp->m_luaref, NULL, args, true, &err);
Object ret = nlua_call_ref(mp->m_luaref, NULL, args, kRetObject, NULL, &err);
if (ret.type == kObjectTypeString) {
p = string_to_cstr(ret.data.string);
}