How to convert from types into an array

BlitzMax Forums/BlitzMax Programming/How to convert from types into an array

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I think you mean lists. Types are just like varibles in BMax meaning you can just do this:
Type myType
	
	Function Create:myType()
		
		Local newType:myType = New myType
		Return newType
		
	End Function
	
	Method New()
		
		x% = Rand(0, 100)
		y% = Rand(0, 100)
		
	End Method
	
	Field x%, y%
	
End Type

Global myTypeList:TList = CreateList()
myTypeList.AddLast myType.Create()

' Type cast
Print myType(myTypeList.Last()).x + ", " + myType(myTypeList.Last()).y

' Convert to an array
Local myTypeArray:Object[] = ListToArray(myTypeList)

' No need for type cast
Print myType(myTypeArray[0]).x + ", " + myType(myTypeArray[0]).y


hope this helps a little.