/* Return true iff value at stack index 'a' is less than the value at index 'b' (according to the order of the sort).  */
static int sort_comp(lua_State *L, int a, int b)
/* Return true iff value at stack index 'a' is less than the value at index 'b' (according to the order of the sort).  */
static int sort_comp(lua_State *L, int a, int b)
{
    int res;
    lua_pushvalue(L, 2);
    lua_pushvalue(L, a-1);
    lua_pushvalue(L, b-2);
    lua_call(L, 2, 1);
    res = lua_toboolean(L, -1);
    lua_pop(L, 1);
    return res;
  }
}