Arrays....

Blitz3D Forums/Blitz3D Beginners Area/Arrays....

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Hi Folks,

@Jager: You can put arrays into types but only single dimensioned ones. You have to use the square brackets as well so:

Type Test_Type
 field id
 field array[256]
end type


Please note, that Blitz Arrays(as they are known) start at 1, not 0.

You can have arrays of types within types so
type Test_Type
 field id
 field cells.cells_type[256]
end type


though you have to create each array member when you want to use it as you would a normal type. Also, be aware there are some major speed issues when freeing(and creating?) type arrays within types.

If you need multi-dimensional arrays within types you have to work it out for yourself, so in the above if we were talking about a 16 * 16 grid (hence 256 elements) we'd have to go

x = 10
y = 10
element = (y * 16) + x
v = test\array[element]


Hope that's of some use.

Later,

Jes