| 488 | {"running", "suspended", "normal", "dead"}; |
| 489 | |
| 490 | static int costatus (lua_State *L, lua_State *co) { |
| 491 | if (L == co) return CO_RUN; |
| 492 | switch (lua_status(co)) { |
| 493 | case LUA_YIELD: |
| 494 | return CO_SUS; |
| 495 | case 0: { |
| 496 | lua_Debug ar; |
| 497 | if (lua_getstack(co, 0, &ar) > 0) /* does it have frames? */ |
| 498 | return CO_NOR; /* it is running */ |
| 499 | else if (lua_gettop(co) == 0) |
| 500 | return CO_DEAD; |
| 501 | else |
| 502 | return CO_SUS; /* initial state */ |
| 503 | } |
| 504 | default: /* some error occured */ |
| 505 | return CO_DEAD; |
| 506 | } |
| 507 | } |
| 508 | |
| 509 | |
| 510 | static int luaB_costatus (lua_State *L) { |
no test coverage detected