I have an elementary problem, caused mostly from the lack of documentation in BlitzMax....
I am trying to sort an array of objects by a field. Here is a sample code:
Am I using .sort() correctly?
I am trying to sort an array of objects by a field. Here is a sample code:
SuperStrict Type TCar Field color:String Field model:String End Type Local Car:TCar[100] For Local n:Int = 0 To 99 Car[n] = New TCar Select Rand(5) Case 1 Car[n].color = "Red" Case 2 Car[n].color = "Green" Case 3 Car[n].color = "Blue" Case 4 Car[n].color = "Purple" Case 5 Car[n].color = "White" End Select Print Car[n].color Next Print "Sorting by color...." Car.Sort() '<-- Obviously, this doesn't work...I need to specify the .color For Local n:Int = 0 To 99 Print Car[n].color Next
Am I using .sort() correctly?