Arrays of types

Blitz3D Forums/Blitz3D Beginners Area/Arrays of types

Oso(Posted 2004) [#1]
Arrays of types have been discussed in various places here. What is the syntax for making an array of types and referring to them in BlitzPlus ? Only linked lists of types appear to be explained in the manual, unless I missed something. The beginners section says you can do it but does not say exactly how.


Matty(Posted 2004) [#2]
Type MyType
field x
field y
field z
end type
Dim Point.MyType(Array Dimensions)
For i=0 to Array Dimensions
Point(i)=new MyType
next

Then to refer to a particular field:

Point(Array Index)\X=....


Oso(Posted 2004) [#3]
Thanks very much, Matty, I appreciate that. The part I didn't understand, and wouldn't have thought of, was that you must use the New command to establish a pointer. Although it is common sense now I think about it.

A bit of fiddling tells me you also seem to be able to nest arrays in types and types in arrays to any desired depth. Don't immediately see where you'd use it but it's nice to know it's there I suppose - just a question of keeping track of the backslashes and square brackets.