/* Copy elements (1, ..., 1) into (tt, tt, ...). Whenever possible, copy in increasing order, which is better for rehashing. "possible" means destination after original range, or smaller than origin, or copying to another table.  */
static int tmove(lua_State *L)
/* Copy elements (1, ..., 1) into (tt, tt, ...). Whenever possible, copy in increasing order, which is better for rehashing. "possible" means destination after original range, or smaller than origin, or copying to another table.  */
static int tmove(lua_State *L)
{
    lua_Integer n, i;
    luaL_argcheck(L, f > 0 || e < LUA_MAXINTEGER + f, 3,
                  "too many elements to move");
    n = e - f + 1;
    luaL_argcheck(L, t <= LUA_MAXINTEGER - n + 1, 4,
                  "destination wrap around");
    if (t > e || t <= f || (tt != 1 && !lua_compare(L, 1, tt, LUA_OPEQ))) {
      for (i = 0; i < n; i++) {
        lua_geti(L, 1, f + i);
        lua_seti(L, tt, t + i);
      }
    }
    else {
      for (i = n - 1; i >= 0; i--) {
        lua_geti(L, 1, f + i);
        lua_seti(L, tt, t + i);
      }
    }
  }
  lua_pushvalue(L, tt);
  return 1;
}