Just getting to grips with types. Is there a simple command to tell me how many of a type I have 'alive', other than doing a quick loop and counting them myself?
Simple command for counting number of types?
Blitz3D Forums/Blitz3D Beginners Area/Simple command for counting number of types? No, but you can easily do it yourself.
For M.MyType = each MyType
Count = Count + 1
next
For M.MyType = each MyType
Count = Count + 1
next
k, thanks.
A more optimized way of doing it would be to have a global type counter, and simply increment or decrement it by one each time you create or delete an instance of that type.
Yeah, but in most situations you cycle through all your types anyway so you can just stick a counter = counter + 1 within your type loop instead of having it as a seperate function.
Not like any of these are particularly "Right". :) Just a few options.