array of type variable?

BlitzMax Forums/BlitzMax Beginners Area/array of type variable?

Arminia(Posted 2006) [#1]
Trying to do the following:

Type character

End Type


degac(Posted 2006) [#2]
what?


Azathoth(Posted 2006) [#3]
There shouldn't be anything stopping you from doing that.


TomToad(Posted 2006) [#4]
Well, looking at the topic, I'd assume he was wanting an array of his character type. If that's the case, you need to do it like this.
Type character
 ... define type
End Type

Local CharacterArray:character[10]
For Local t:int = 0 to 9
 CharacterArray[t] = New character
Next

You need to loop through each element of the array and create the type because BlitzMAX doesn't do that for you.


Dreamora(Posted 2006) [#5]
or local CharacterArray:character[] = new character[10]


TomToad(Posted 2006) [#6]
But you would still need to loop through the array. According to the docs, the array elements are initialized to Null
Arrays may also be created 'on the fly' using the syntax:
New ElementType[Dimension1,Dimension2 etc...]

This returns an array of the specified dimension(s) with each element initialized to Null.