]> git.lizzy.rs Git - minetest.git/blobdiff - lib/lua/src/ldo.c
Modify PUC Lua to wrap C++ exceptions (#12445)
[minetest.git] / lib / lua / src / ldo.c
index d1bf786cb7202368755eeba13e3d43b49053b2df..57d2ac7c2c403283bf6587ab2f6fdbfaf8518851 100644 (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;