Getting a type based on a value(fast)?

Blitz3D Forums/Blitz3D Beginners Area/Getting a type based on a value(fast)?

neos300(Posted 2009) [#1]
Is there any other way than to do this other than slow for each loop?


Stevie G(Posted 2009) [#2]
You can use an array of types, like so .

Type MyType
  field x#, y#, z#
End Type

Dim MYarray.MyType(100)

For l = 0 to 100
  MYarray(l) = new MyType
  MYarray(l)\x = blah
  MYarray(l)\y = blah
Next
[\code]


To get the y value for the 53rd instance use:

[code]
Print MYarray( 52 )\y


Or make use of object and handle. It depends on what you're doing really?


neos300(Posted 2009) [#3]
Ok, basically what i am doing is I create an object, then i need to find it later on, but I don't know where i put it in the first place(like dynamically creating them)

I will look into object and handle


Beaker(Posted 2009) [#4]
Or use something like a Map.