1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Modify PUC Lua to wrap C++ exceptions (#12445)

This commit is contained in:
Jude Melton-Houghton 2022-09-26 07:23:48 -04:00 committed by GitHub
parent f916398a54
commit 03428d9825
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 105 additions and 4 deletions

View file

@ -317,7 +317,11 @@ int luaD_precall (lua_State *L, StkId func, int nresults) {
if (L->hookmask & LUA_MASKCALL)
luaD_callhook(L, LUA_HOOKCALL, -1);
lua_unlock(L);
n = (*curr_func(L)->c.f)(L); /* do the actual call */
/* MINETEST-SPECIFIC CHANGE: Let custom code wrap C function calls. */
if (G(L)->wrapcf)
n = G(L)->wrapcf(L, *curr_func(L)->c.f);
else
n = (*curr_func(L)->c.f)(L);
lua_lock(L);
if (n < 0) /* yielding? */
return PCRYIELD;