| 324 | |
| 325 | |
| 326 | int luaE_resetthread (lua_State *L, int status) { |
| 327 | CallInfo *ci = L->ci = &L->base_ci; /* unwind CallInfo list */ |
| 328 | setnilvalue(s2v(L->stack)); /* 'function' entry for basic 'ci' */ |
| 329 | ci->func = L->stack; |
| 330 | ci->callstatus = CIST_C; |
| 331 | if (status == LUA_YIELD) |
| 332 | status = LUA_OK; |
| 333 | status = luaD_closeprotected(L, 1, status); |
| 334 | if (status != LUA_OK) /* errors? */ |
| 335 | luaD_seterrorobj(L, status, L->stack + 1); |
| 336 | else |
| 337 | L->top = L->stack + 1; |
| 338 | ci->top = L->top + LUA_MINSTACK; |
| 339 | L->status = cast_byte(status); |
| 340 | luaD_reallocstack(L, cast_int(ci->top - L->stack), 0); |
| 341 | return status; |
| 342 | } |
| 343 | |
| 344 | |
| 345 | LUA_API int lua_resetthread (lua_State *L) { |
no test coverage detected