MCPcopy Create free account
hub / github.com/ObEngine/ObEngine / luaD_pcall

Function luaD_pcall

extlibs/lua/src/ldo.c:742–761  ·  view source on GitHub ↗

** Call the C function 'func' in protected mode, restoring basic ** thread information ('allowhook', etc.) and in particular ** its stack level in case of errors. */

Source from the content-addressed store, hash-verified

740** its stack level in case of errors.
741*/
742int luaD_pcall (lua_State *L, Pfunc func, void *u,
743 ptrdiff_t old_top, ptrdiff_t ef) {
744 int status;
745 CallInfo *old_ci = L->ci;
746 lu_byte old_allowhooks = L->allowhook;
747 ptrdiff_t old_errfunc = L->errfunc;
748 L->errfunc = ef;
749 status = luaD_rawrunprotected(L, func, u);
750 if (unlikely(status != LUA_OK)) { /* an error occurred? */
751 StkId oldtop = restorestack(L, old_top);
752 L->ci = old_ci;
753 L->allowhook = old_allowhooks;
754 status = luaF_close(L, oldtop, status);
755 oldtop = restorestack(L, old_top); /* previous call may change stack */
756 luaD_seterrorobj(L, status, oldtop);
757 luaD_shrinkstack(L);
758 }
759 L->errfunc = old_errfunc;
760 return status;
761}
762
763
764

Callers 4

callclosemthFunction · 0.85
luaD_protectedparserFunction · 0.85
lua_pcallkFunction · 0.85
GCTMFunction · 0.85

Calls 4

luaD_rawrunprotectedFunction · 0.85
luaF_closeFunction · 0.85
luaD_seterrorobjFunction · 0.85
luaD_shrinkstackFunction · 0.85

Tested by

no test coverage detected