MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / lua_resume

Function lua_resume

third-party/lua-5.2.4/src/ldo.c:535–564  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

533
534
535LUA_API int lua_resume (lua_State *L, lua_State *from, int nargs) {
536 int status;
537 int oldnny = L->nny; /* save 'nny' */
538 lua_lock(L);
539 luai_userstateresume(L, nargs);
540 L->nCcalls = (from) ? from->nCcalls + 1 : 1;
541 L->nny = 0; /* allow yields */
542 api_checknelems(L, (L->status == LUA_OK) ? nargs + 1 : nargs);
543 status = luaD_rawrunprotected(L, resume, L->top - nargs);
544 if (status == -1) /* error calling 'lua_resume'? */
545 status = LUA_ERRRUN;
546 else { /* yield or regular error */
547 while (status != LUA_OK && status != LUA_YIELD) { /* error? */
548 if (recover(L, status)) /* recover point? */
549 status = luaD_rawrunprotected(L, unroll, NULL); /* run continuation */
550 else { /* unrecoverable error */
551 L->status = cast_byte(status); /* mark thread as `dead' */
552 seterrorobj(L, status, L->top);
553 L->ci->top = L->top;
554 break;
555 }
556 }
557 lua_assert(status == L->status);
558 }
559 L->nny = oldnny; /* restore 'nny' */
560 L->nCcalls--;
561 lua_assert(L->nCcalls == ((from) ? from->nCcalls : 0));
562 lua_unlock(L);
563 return status;
564}
565
566
567LUA_API int lua_yieldk (lua_State *L, int nresults, int ctx, lua_CFunction k) {

Callers 1

auxresumeFunction · 0.70

Calls 3

luaD_rawrunprotectedFunction · 0.70
recoverFunction · 0.70
seterrorobjFunction · 0.70

Tested by

no test coverage detected