MCPcopy Create free account
hub / github.com/DFHack/dfhack / finishpcall

Function finishpcall

depends/lua/src/lbaselib.c:408–416  ·  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

406** ignored).
407*/
408static int finishpcall (lua_State *L, int status, lua_KContext extra) {
409 if (status != LUA_OK && status != LUA_YIELD) { /* error? */
410 lua_pushboolean(L, 0); /* first result (false) */
411 lua_pushvalue(L, -2); /* error message */
412 return 2; /* return false, msg */
413 }
414 else
415 return lua_gettop(L) - (int)extra; /* return all results */
416}
417
418
419static 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