let's say you have:
var games = new Array();
games[gameNum] = new GAME(gameNum, rotNum1, rotNum2, ... );
(
so a sparsley populate array which enables me to locate a game usin
the game number without having to implement a "search" function on th
games array
games[4325] = new GAME(4325, 201, 202, 'Baseball', 'MLB', ... );
).
games.sort();
... works but gives me a sort that I don't care about. Worse than tha
it "re-indexes" the array and now the first element is 0, the nex
element is 1, and so on. I can't locate a game by the gamenumbe
without implementing a search function.
so here comes a sort function (for the first problem, I deal with th
renumbering by creating a temp array, copying things over, sorting th
temp array and bringing everything back in the original array. nast
business).
function sortByRot( gameA, gameB )
{
return gameA.rotNum1 - gameB.rotNum2;
}
which I was hoping would let me do:
games.sort(sort ByRot);
But in IE and Mozialla I get
"An exception of type "Microsoft JScript runtime error: Out of memory
was not handled." message. Now I'm facing the unpleasant task o
handling the sort myself.
Any help would be most welcome.
Regards,
Gamble
-
gamble
Comment