indexing types
Blitz3D Forums/Blitz3D Programming/indexing types
| ||
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) |
| ||
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. |
| ||
thought as much thanks. |
| ||
Using Object and Handle, you can get the handle for the type: |
| ||
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 |
| ||
thanks guys, mabe if we smile at mr sibly he can write in a b.boobs=indexed boobs[10] :) |
| ||
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 |