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