Array in Custom Type
Blitz3D Forums/Blitz3D Beginners Area/Array in Custom Type
| ||
Is it possible to have an array contained within a custom type? Such as Type MyType Field array(99) End Type If so, how would I do this? What is the required syntax? |
| ||
Just use square brackets instead: Field array[99] These arrays can only be one dimension, though. |
| ||
and can't be resized. => dim can be resize : Dim Thing(0) function do_something() dim thing(50) for i = 1 to 50 thing(i)= any number... next use the dim to fill any code... vertexcoords s,idVert,thing(???) , etc... dim thing(0) ; reset the array end function => in type, you can't do that. => every type created will automatically fill an array declared in the type list. So , taje care of the array size . Sometime we declare arrays, and them we create 5000 sprite that use an array of 1000 cell = result in large memory used. If only need 10 cells fos the array => declare it in the Type FieldList. |
| ||
If you need dynamic arrays in your types, there are 2 ways: 1. Self created linked list 2. Bank. Thats the normally used way as it has dynamic size. Through Object and Handle functions you can even push type instances into banks. |
| ||
re 2, see my sig. vectors specifically. |