Accessing objects in a list

BlitzMax Forums/BlitzMax Beginners Area/Accessing objects in a list

Just a couple of brackets missing there..

.List()

Strict

Type TMytype
	Field Z% = 100
End Type

Local Mylist:TList = CreateList()

Local Test01:TMytype = New TMytype
MyList.AddLast Test01

Local Test02:TMytype = New TMytype
MyList.AddLast Test02

' compare last object in list
If test02 = Mylist.Last() Print test02.Z

' cast 'object' from list to 'TMytype'
Local Test03:TMytype=TMytype(Mylist.Last())
Print Test03.z