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