TLists

BlitzMax Forums/BlitzMax Programming/TLists

Have you been fiddeling around with the internal structures of the linked list? Because that works:
Global object_list:TList = CreateList()

o1:TTest = New TTest
object_list.AddLast o1

o2:TTest = New TTest
object_list.AddLast o2

o3:TTest = New TTest
object_list.AddLast o3

For o:TTest = EachIn object_list
	Print "Obj: " + o.ToString()
Next

o1.Destroy()
o2.Destroy()
o3.Destroy()

For o:TTest = EachIn object_list
	Notify "Obj: " + o.ToString()
Next

Type TTest
	Method Destroy()			
		object_list.Remove(Self)
		If object_list.contains(Self) Then Notify "Gah"
	End Method
EndType


'Contains(val:Object)' traverses all TLinks within the linked list and returns True when the value of one of them matches 'val'.

-- Byteemoz