/* Resumes a coroutine. Returns the number of results for non-error cases or -1 for errors.  */
static int auxresume(lua_State *L, lua_State *co, int narg)
/* Resumes a coroutine. Returns the number of results for non-error cases or -1 for errors.  */
static int auxresume(lua_State *L, lua_State *co, int narg)
{
    lua_pushliteral(L, "too many arguments to resume");
    return -1;
  }
  lua_xmove(L, co, narg);
  status = lua_resume(co, L, narg, &nres);
  if (l_likely(status == LUA_OK || status == LUA_YIELD)) {
    if (l_unlikely(!lua_checkstack(L, nres + 1))) {
      lua_pop(co, nres);
      lua_pushliteral(L, "too many results to resume");
      return -1;
    }
    lua_xmove(co, L, nres);
    return nres;
  }
  else {
    lua_xmove(co, L, 1);
    return -1;
  }
}