| 11352 | {"running", "suspended", "normal", "dead"}; |
| 11353 | |
| 11354 | static int costatus (lua_State *L, lua_State *co) { |
| 11355 | if (L == co) return CO_RUN; |
| 11356 | switch (lua_status(co)) { |
| 11357 | case LUA_YIELD: |
| 11358 | return CO_SUS; |
| 11359 | case 0: { |
| 11360 | lua_Debug ar; |
| 11361 | if (lua_getstack(co, 0, &ar) > 0) /* does it have frames? */ |
| 11362 | return CO_NOR; /* it is running */ |
| 11363 | else if (lua_gettop(co) == 0) |
| 11364 | return CO_DEAD; |
| 11365 | else |
| 11366 | return CO_SUS; /* initial state */ |
| 11367 | } |
| 11368 | default: /* some error occured */ |
| 11369 | return CO_DEAD; |
| 11370 | } |
| 11371 | } |
| 11372 | |
| 11373 | |
| 11374 | static int luaB_costatus (lua_State *L) { |
no test coverage detected