Arrays in types
Blitz3D Forums/Blitz3D Beginners Area/Arrays in types
| ||
Hi! There's someone who knows how I can register arrays inside a type, for ex.Type player Field a Field Dim b(20) End Type Thanks! |
| ||
you were so close!! Type player Field a Field b[20] End Type :) |
| ||
Note that the square-bracket array declaration format is undocumented, (which means "technically unsupported") for one reason or another (though you can use it fine). Also note that you can only have 1-dimensional arrays in this format. I also seem to remember some people doing tests and it seems to me as if array access for [] arrays were slower than for the Dim() arrays. That's just the impression in my head though -- I could be way off-base. |
| ||
As documented elsewhere, you can emmulate multi-dimesnion array assignments by the process of multiplying the range of each by the others, such as: Type Days Field hhmmss[24*60*60] ;Int(hhmmss/3600) for hours, ;(hhmmss/60) Mod 60 for minutes, ;hhmmss Mod 60 for seconds End Type |