MCPcopy Create free account
hub / github.com/defold/defold / resume

Function resume

engine/lua/src/lua/ldo.c:383–405  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

381
382
383static void resume (lua_State *L, void *ud) {
384 StkId firstArg = cast(StkId, ud);
385 CallInfo *ci = L->ci;
386 if (L->status == 0) { /* start coroutine? */
387 lua_assert(ci == L->base_ci && firstArg > L->base);
388 if (luaD_precall(L, firstArg - 1, LUA_MULTRET) != PCRLUA)
389 return;
390 }
391 else { /* resuming from previous yield */
392 lua_assert(L->status == LUA_YIELD);
393 L->status = 0;
394 if (!f_isLua(ci)) { /* `common' yield? */
395 /* finish interrupted execution of `OP_CALL' */
396 lua_assert(GET_OPCODE(*((ci-1)->savedpc - 1)) == OP_CALL ||
397 GET_OPCODE(*((ci-1)->savedpc - 1)) == OP_TAILCALL);
398 if (luaD_poscall(L, firstArg)) /* complete it... */
399 L->top = L->ci->top; /* and correct top if not multiple results */
400 }
401 else /* yielded inside a hook: just continue its execution */
402 L->base = L->ci->base;
403 }
404 luaV_execute(L, cast_int(L->ci - L->base_ci));
405}
406
407
408static int resume_error (lua_State *L, const char *msg) {

Callers

nothing calls this directly

Calls 3

luaD_precallFunction · 0.85
luaD_poscallFunction · 0.85
luaV_executeFunction · 0.85

Tested by

no test coverage detected