Type with an Array Field

Blitz3D Forums/Blitz3D Beginners Area/Type with an Array Field

Fry Crayola(Posted 2004) [#1]
From my (albeit limited) look around, it doesn't appear possible to create a field within a type that is an array, e.g.

Type theType
Field x(50)
End Type


solves nothing, nor does

Type theType
Field x
End Type

a = new TheType
Dim a\x(50)


Can it be done? A number of objects in my game have a list of strings that go with it. Rather than dimension a large number from the beginning and then have to keep track of them, what's object is using what list, what lists are free, etc. I'd like the simpler method of creating the list when the object is created, storing it with all the other fields of the type.

Can it be done?


simonh(Posted 2004) [#2]
You need to use square brackets:
Type theType
Field x[50]
End Type
They can only be one-dimensional though.


RetroBooster(Posted 2004) [#3]
Please don't make the mistake of relying on them for use in any type you are going to have more then say a 100 of them, they take AGES to free. (like 5 to 30 seconds for a 1000 depending on their size/the ammount of arrays)


semar(Posted 2004) [#4]

they take AGES to free.


That has been fixed in the newest release:

Blitz3D 1.87 and BlitzPlus 1.39 updates now available!
Both updates feature an upgrade to FMOD 3.72 and a fix for the notorious slow memory release problem.