Help needed - Array of Types in a Type

BlitzMax Forums/BlitzMax Programming/Help needed - Array of Types in a Type

daaan(Posted 2006) [#1]
Is this possible? I've kind of hit a dead end on a current project until I can figure this out.

Thanks in advance.


daaan(Posted 2006) [#2]
Got it!

' array of types in a type

Type TypeA
	
	Field TB_Array:TypeB[ 10 ]
	
End Type

Type TypeB
	
	Field x#, y#, r
		
End Type

NewTypeA:TypeA = New TypeA
NewTypeA.TB_Array:TypeB[ 0 ] = New TypeB
NewTypeA.TB_Array:TypeB[ 0 ].x# = Rnd( -10, 10 )
NewTypeA.TB_Array:TypeB[ 0 ].y# = Rnd( -10, 10 )
NewTypeA.TB_Array:TypeB[ 0 ].r = Rand( 1, 10 )

Print NewTypeA.TB_Array:TypeB[ 0 ].x#
Print NewTypeA.TB_Array:TypeB[ 0 ].y#
Print NewTypeA.TB_Array:TypeB[ 0 ].r

Print "It worked!"



Booticus(Posted 2006) [#3]
Right on!


Why0Why(Posted 2006) [#4]
Thanks for posting the solution, it helped me.