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

Function luaD_pcall

xrepo/packages/l/lua/port/lua/src/ldo.c:919–936  ·  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

917** its stack level in case of errors.
918*/
919int luaD_pcall (lua_State *L, Pfunc func, void *u,
920 ptrdiff_t old_top, ptrdiff_t ef) {
921 int status;
922 CallInfo *old_ci = L->ci;
923 lu_byte old_allowhooks = L->allowhook;
924 ptrdiff_t old_errfunc = L->errfunc;
925 L->errfunc = ef;
926 status = luaD_rawrunprotected(L, func, u);
927 if (l_unlikely(status != LUA_OK)) { /* an error occurred? */
928 L->ci = old_ci;
929 L->allowhook = old_allowhooks;
930 status = luaD_closeprotected(L, old_top, status);
931 luaD_seterrorobj(L, status, restorestack(L, old_top));
932 luaD_shrinkstack(L); /* restore stack size in case of overflow */
933 }
934 L->errfunc = old_errfunc;
935 return status;
936}
937
938
939

Callers 3

luaD_protectedparserFunction · 0.70
lua_pcallkFunction · 0.70
GCTMFunction · 0.70

Calls 4

luaD_closeprotectedFunction · 0.85
luaD_seterrorobjFunction · 0.85
luaD_shrinkstackFunction · 0.85
luaD_rawrunprotectedFunction · 0.70

Tested by

no test coverage detected