MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / luaD_pcall

Function luaD_pcall

lib/lua/src/ldo.c:950–967  ·  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

948** its stack level in case of errors.
949*/
950int luaD_pcall (lua_State *L, Pfunc func, void *u,
951 ptrdiff_t old_top, ptrdiff_t ef) {
952 int status;
953 CallInfo *old_ci = L->ci;
954 lu_byte old_allowhooks = L->allowhook;
955 ptrdiff_t old_errfunc = L->errfunc;
956 L->errfunc = ef;
957 status = luaD_rawrunprotected(L, func, u);
958 if (l_unlikely(status != LUA_OK)) { /* an error occurred? */
959 L->ci = old_ci;
960 L->allowhook = old_allowhooks;
961 status = luaD_closeprotected(L, old_top, status);
962 luaD_seterrorobj(L, status, restorestack(L, old_top));
963 luaD_shrinkstack(L); /* restore stack size in case of overflow */
964 }
965 L->errfunc = old_errfunc;
966 return status;
967}
968
969
970

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