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

Function finishpcall

3rd/lua-5.4.3/src/lbaselib.c:440–448  ·  view source on GitHub ↗

** Continuation function for 'pcall' and 'xpcall'. Both functions ** already pushed a 'true' before doing the call, so in case of success ** 'finishpcall' only has to return everything in the stack minus ** 'extra' values (where 'extra' is exactly the number of items to be ** ignored). */

Source from the content-addressed store, hash-verified

438** ignored).
439*/
440static int finishpcall (lua_State *L, int status, lua_KContext extra) {
441 if (l_unlikely(status != LUA_OK && status != LUA_YIELD)) { /* error? */
442 lua_pushboolean(L, 0); /* first result (false) */
443 lua_pushvalue(L, -2); /* error message */
444 return 2; /* return false, msg */
445 }
446 else
447 return lua_gettop(L) - (int)extra; /* return all results */
448}
449
450
451static int luaB_pcall (lua_State *L) {

Callers 2

luaB_pcallFunction · 0.85
luaB_xpcallFunction · 0.85

Calls 3

lua_pushbooleanFunction · 0.85
lua_pushvalueFunction · 0.85
lua_gettopFunction · 0.85

Tested by

no test coverage detected