Say I have an array of Types, ie:
As you can see if you run this, Array.sort doesn't seem to
sort Types at all when I address the type so vaguely.
How would I go about sorting an array of Types by one
of their internal values?
Say I want to sort the array by the value of Array[].x
[edit] I should mention, I'm trying to get arrays to work
before I go with a List because I'm using this to sort the z
positions of sprites in a graphic engine. I need speed!
Type blahType 'define the class Field x, y EndType Local array:blahType[21] 'set array memory For Local a = 0 To 20 'initialize slots array[a] = New blahType array[a].x = Rand(100) array[a].y = Rand(100) Print array[a].x+" "+array[a].y 'print what we've got Next array.sort '<i>sort</i> damn you! (Of course this is too vague) Print For a = 0 To 20 'show results Print array[a].x+" "+array[a].y Next
As you can see if you run this, Array.sort doesn't seem to
sort Types at all when I address the type so vaguely.
How would I go about sorting an array of Types by one
of their internal values?
Say I want to sort the array by the value of Array[].x
[edit] I should mention, I'm trying to get arrays to work
before I go with a List because I'm using this to sort the z
positions of sprites in a graphic engine. I need speed!