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

Function lua_resume

third-party/lua-5.1.5/src/ldo.c:418–441  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

416
417
418LUA_API int lua_resume (lua_State *L, int nargs) {
419 int status;
420 lua_lock(L);
421 if (L->status != LUA_YIELD && (L->status != 0 || L->ci != L->base_ci))
422 return resume_error(L, "cannot resume non-suspended coroutine");
423 if (L->nCcalls >= LUAI_MAXCCALLS)
424 return resume_error(L, "C stack overflow");
425 luai_userstateresume(L, nargs);
426 lua_assert(L->errfunc == 0);
427 L->baseCcalls = ++L->nCcalls;
428 status = luaD_rawrunprotected(L, resume, L->top - nargs);
429 if (status != 0) { /* error? */
430 L->status = cast_byte(status); /* mark thread as `dead' */
431 luaD_seterrorobj(L, status, L->top);
432 L->ci->top = L->top;
433 }
434 else {
435 lua_assert(L->nCcalls == L->baseCcalls);
436 status = L->status;
437 }
438 --L->nCcalls;
439 lua_unlock(L);
440 return status;
441}
442
443
444LUA_API int lua_yield (lua_State *L, int nresults) {

Callers 1

auxresumeFunction · 0.70

Calls 3

resume_errorFunction · 0.70
luaD_rawrunprotectedFunction · 0.70
luaD_seterrorobjFunction · 0.70

Tested by

no test coverage detected