Accessing one TYPE object out of lots directly

Blitz3D Forums/Blitz3D Programming/Accessing one TYPE object out of lots directly

Fry Crayola(Posted 2004) [#1]
I have a type construct that has a fair few hundred elements at present. Each one has a field which contains its unique ID, which I need so that other sections of the game can work out what object it is and so forth.

Is there any way I can access this one directly without having to do a For Each loop? Or is there another way of coding it - perhaps something I've missed - that allows me to directly access one specific object?

Now, I could use an array of objects, each element of the array pointing to one object, and I could reference that. However, doing that means that either the array will be absolutely huge with many empty elements, or I have to abandon the current system I use for unique IDs (where the first two digits correspond to what it belongs to) which makes a lot of the design and coding a much bigger headache than it really needs to be.

Any ideas, or am I doomed to either get a big headache or use a For Each loop?


Dreamora(Posted 2004) [#2]
Use handle() and object()


Fry Crayola(Posted 2004) [#3]
I don't see them mentioned in the manual. Any more info on them? I've noticed that Object is a reserved word before, despite not being able to find it.


Dreamora(Posted 2004) [#4]
Handle() returns the integer handle of a type instance

trala.test = object.trala( handle ) returns the type instance with the given handle


Fry Crayola(Posted 2004) [#5]
Aye, I found it after a search. Cheers.