indexing types

Blitz3D Forums/Blitz3D Programming/indexing types

D4NM4N(Posted 2005) [#1]
is there a way, instead of first last after etc to index a type using a number. rather than using for next to search an index field

rather than :
for b.bollocks.each bollocks
if b\index=20 exit
next

is there something like :
b.bollocks=bollocks(20)


semar(Posted 2005) [#2]
No, sorry.

But you can use a mixed way to store your info, using array of types - that is, each array item refers to a type element, so you could then do something like:

print array_of_bollocks(20)\score


Sergio.


D4NM4N(Posted 2005) [#3]
thought as much

thanks.


Ezbe(Posted 2005) [#4]
Using Object and Handle, you can get the handle for the type:




Rob Farley(Posted 2005) [#5]
It's a shame with types that there isn't 'proper' database indexing, that way you could do something like:
type bollock
field id
field size
indexon id
end type

find bollock where bollock.id=5



D4NM4N(Posted 2005) [#6]
thanks guys, mabe if we smile at mr sibly he can write in a

b.boobs=indexed boobs[10]

:)


Craig H. Nisbet(Posted 2005) [#7]
What!!! of course you can do that!!

MaxBoobs = 20

Type boobs
field Size
field id
end type

Dim BoobList.boobs(MaxBoobs)

for B = 1 to MaxBoobs
booblist(B) = new boobs
booblist(B)\Size = B * 10
booblist(B)\id = B ;not needed, but handy
next

;Usage

Index = 5
MyBoobs.boobs = booblist(Index)
print MyBoobs\Size
pring MyBoobs\ID