| 109 | |
| 110 | |
| 111 | static int luaB_costatus (lua_State *L) { |
| 112 | lua_State *co = getco(L); |
| 113 | if (L == co) lua_pushliteral(L, "running"); |
| 114 | else { |
| 115 | switch (lua_status(co)) { |
| 116 | case LUA_YIELD: |
| 117 | lua_pushliteral(L, "suspended"); |
| 118 | break; |
| 119 | case LUA_OK: { |
| 120 | lua_Debug ar; |
| 121 | if (lua_getstack(co, 0, &ar) > 0) /* does it have frames? */ |
| 122 | lua_pushliteral(L, "normal"); /* it is running */ |
| 123 | else if (lua_gettop(co) == 0) |
| 124 | lua_pushliteral(L, "dead"); |
| 125 | else |
| 126 | lua_pushliteral(L, "suspended"); /* initial state */ |
| 127 | break; |
| 128 | } |
| 129 | default: /* some error occurred */ |
| 130 | lua_pushliteral(L, "dead"); |
| 131 | break; |
| 132 | } |
| 133 | } |
| 134 | return 1; |
| 135 | } |
| 136 | |
| 137 | |
| 138 | static int luaB_yieldable (lua_State *L) { |
nothing calls this directly
no test coverage detected