Accessing objects in a list

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

Hey,

How do i access directly the object that is being "pointed" by a link in a list?

For example:

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

If test02 = Mylist.Last Then Print test02.Z


In this case, I want to print "Z" field only if Test02 is the last on the list. But I get a "Types 'TMytype' and 'Object()' are unrelated". While I understand the error, I don't know how to get around it.

Also, can I access an object like Mylist.last.Z ? (it doesn't work with the "last" method).

And while I'm at it... are there any tutorials on using lists and objects? I did some basic ones, but I'm afraid I didn't find nearly as many examples under different situations as I'd like.

Thanks!