From 03428d9825cfdf2cfaed6ac9410dafccac0d4f3a Mon Sep 17 00:00:00 2001 From: Jude Melton-Houghton Date: Mon, 26 Sep 2022 07:23:48 -0400 Subject: Modify PUC Lua to wrap C++ exceptions (#12445) --- lib/lua/src/ldo.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/lua/src/ldo.c') diff --git a/lib/lua/src/ldo.c b/lib/lua/src/ldo.c index d1bf786cb..57d2ac7c2 100644 --- a/lib/lua/src/ldo.c +++ b/lib/lua/src/ldo.c @@ -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; -- cgit v1.2.3