Types, handles, arrays

BlitzMax Forums/BlitzMax Beginners Area/Types, handles, arrays

Who was John Galt?(Posted 2004) [#1]
local selc:circle[2]

In bmax, does this create an array of handles to circle objects or an array containing memory for 2 circle structures?


FlameDuck(Posted 2004) [#2]
In your terminology, what is the difference between a "handle" and "memory"?

If I understand the question correctly, I'd say it's the first. It creates an array containing empty references to 2 circle objects.

In order to put references into the array, you would have to go (for example) selc[0] = New circle, and selc[1] = New circle respectively.


Beaker(Posted 2004) [#3]
The former.


Who was John Galt?(Posted 2004) [#4]
OK thanks guys. I think you both correctly understood what I was trying to get at and thanx for the replies.

Out of interest, is there any way to do the latter, with all the structures stored consecutively in memory rather than wherever individual new commands put them?


Perturbatio(Posted 2004) [#5]
Try this:
 Graphics 640,480,0
 Type TCircle
 	Field x
 End Type
 
 Local selc:Tcircle[] =[New TCircle, New TCircle]
 selc[0].x = 2
 Print selc[0].x
 WaitKey



marksibly(Posted 2004) [#6]

Out of interest, is there any way to do the latter, with all the structures stored consecutively in memory rather than wherever individual new commands put them?



No, Max doesn't do 'static' arrays.


Who was John Galt?(Posted 2004) [#7]
OK, cheers Mark, Perturbatio.