
11-21-2008, 06:37 PM
|
I never asked for this.
|
Join Date: Jun 2005
Posts: 855
|
|
Sorting numerical data to index
I'm terrible with this sort of stuff - not just in GS2 but in Python aswell.
I'm basically after a function that sifts through a list file (probably not the right term for gs2, but basically what I mean) and resorts the list so the index of said list matches to the contents being sorted in a ascending or descending order.
So basically, I feed it a list with the contents [11,24,55,9,17] and the variable to sort ascending, and it returns:
list[0] = 9
list[1] = 11
list[2] = 17
list[3] = 24
etc, etc
But not only that, I'd need the function to be able to do this and reassign two pieces of data, so each number would be linked to a string. (list[0] = "9, raeiphon" - picture a scoreboard as such) This would be easy if GS2 supported tuples, but I've been gone from the scripting scene for so long I can barely remember anything about it.
I'm not asking for a script that does exactly this. I'm asking for advice on what methods I should take to properly learn how to do this - what to read up on, what to think, what to sort. A script would be nice if it was properly commented and whatnot, but I doubt anyone would be willing to spare the time to do that, if it's as hard as I think it is.
There's probably a really simple way to do this too. -sigh- |
__________________
I hope for nothing. I fear nothing. I am free.
|
|
|