Object Handle in array ?

Blitz3D Forums/Blitz3D Beginners Area/Object Handle in array ?

Ross C(Posted 2004) [#1]
Hey, i was wondering if i could put the type pointers in an array via Handle command and read them back using object. This would give me direct access to any of the types, much like an array. Is this possible?


DarkEagle(Posted 2004) [#2]
yep that would work. you dont even need to use handle/type though...

type mytype
 field dum1
 field dum2
end type

dim myarray.mytype(10,10)

for x = 0 to 10
 for y = 0 to 10
  myarray(x,y) = new mytype
  myarray(x,y)\dum1 = x + y
  myarray(x,y)\dum2 = x * y
 next
next

x = int(input("X: "))
y = int(input("Y: "))

print "X+Y = " + x+y
print "X*Y = " + x*y

print "From array:"

print "X+Y = " + myarray(x,y)\dum1
print "X*Y = " + myarray(x,y)\dum2



should work :P


Ross C(Posted 2004) [#3]
Cool :D Thanks man!