Can someone explain me theese commands: Object and Handle, to use with types and pointers?
Object and Handle
Blitz3D Forums/Blitz3D Programming/Object and Handle Basicly handle creates a unique integer reference to a type instance and object recovers the type instance for a given handle. The integer reference is incremented sequentially for each new handle obtained, so this will eventually overflow if you create a lot of instances and get handles for them.
You get a handle simply by doing
num=handle(q.qaz)
You test for a valid handle for a type instance by doing
q.qaz=object.qaz(num)
if q<>null then ...
This will fail if the type instance referenced by a given handle belongs to another type or has been deleted.
Now this does have its uses but they are few and far between . The favorite use is fast entity lookup into a type list by storing the handle to the type in the entity name. There is an example on the archives. http://www.blitzbasic.com/codearcs/codearcs.php?code=216
You get a handle simply by doing
num=handle(q.qaz)
You test for a valid handle for a type instance by doing
q.qaz=object.qaz(num)
if q<>null then ...
This will fail if the type instance referenced by a given handle belongs to another type or has been deleted.
Now this does have its uses but they are few and far between . The favorite use is fast entity lookup into a type list by storing the handle to the type in the entity name. There is an example on the archives. http://www.blitzbasic.com/codearcs/codearcs.php?code=216
thanks.