MCPcopy Create free account
hub / github.com/CppCXY/EmmyLuaCodeStyle / luaD_pcall

Function luaD_pcall

3rd/lua-5.4.3/src/ldo.c:885–902  ·  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

883** its stack level in case of errors.
884*/
885int luaD_pcall (lua_State *L, Pfunc func, void *u,
886 ptrdiff_t old_top, ptrdiff_t ef) {
887 int status;
888 CallInfo *old_ci = L->ci;
889 lu_byte old_allowhooks = L->allowhook;
890 ptrdiff_t old_errfunc = L->errfunc;
891 L->errfunc = ef;
892 status = luaD_rawrunprotected(L, func, u);
893 if (l_unlikely(status != LUA_OK)) { /* an error occurred? */
894 L->ci = old_ci;
895 L->allowhook = old_allowhooks;
896 status = luaD_closeprotected(L, old_top, status);
897 luaD_seterrorobj(L, status, restorestack(L, old_top));
898 luaD_shrinkstack(L); /* restore stack size in case of overflow */
899 }
900 L->errfunc = old_errfunc;
901 return status;
902}
903
904
905

Callers 3

luaD_protectedparserFunction · 0.85
lua_pcallkFunction · 0.85
GCTMFunction · 0.85

Calls 4

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

Tested by

no test coverage detected