Using Blitz3D Types

Started by JBR, June 06, 2020, 20:42:40

Previous topic - Next topic

JBR

Hi,

Couple of questions about what a type can hold.

Type T_MyType
     field a%
     field array[20]                  same as dim array(20)
end type

In the above I'm using the 'secret array method' and the type of the array can be a type e.g. array.T_Type[20]

Is what I'm doing ok? And why not just use [ ] all the time?

Thanks, Jim.

hosch

#1
Yes, types within types can be used that way.

But array[20] is not the same as DIM array(20)

An array defined by square brackets is a Blitz Array. Blitz Arrays can only be

  • one dimensional
  • defined as global or local (as opposed to an array created by Dim, which is always global)
  • can be used as a parameter for a function
  • can be used to hold a type

The method you choose depends on what you are planning to do with the data. I usually go for types and loop through them with "Each", I rarely use an array as a type.

JBR

Thanks man, getting there slowly but surely!

Jim