Help on 'types' please.

BlitzMax Forums/BlitzMax Beginners Area/Help on 'types' please.

Blitz3D has an internal list for each type, this is quite different in BlitzMax where you have to keep track of the types yourself.
Also since BlitzMax has garbage collection, Delete wont work, the object has to go out of scope or all references to it must be removed.

Here is an example:
SuperStrict

Type TBullet
    Field x:Int,y:Int
EndType

' the bullet list
Global list:TList = New TList

' fill the list
For Local i:Int = 1 To 10
    Local b:TBullet = New TBullet
    b.x = Rand(1,200)
    b.y = Rand(1,200)
    list.AddLast(b)
Next

' loop through the list
For Local b:TBullet = EachIn list
    Print b.x + "," + b.y
Next

' clear the list AND "delete" all types in the list (although there is no guarantee that they will be deleted as this is up the the GC)
list.Clear()