tlist access problem

BlitzMax Forums/BlitzMax Beginners Area/tlist access problem

Bremer(Posted 2005) [#1]
Lets say that I have the following code:

Global list1:TList = CreateList()
Type test1
Field x#, y#, z#
End Type

Global list2:TList = CreateList()
Type test2
Field othertest
End Type

Local temp1:test1 = New test1
temp1x# = 1.0
temp1y# = 1.0
temp1z# = 1.0
ListAddLast list1,temp1

Local temp2:test2 = New test2
temp2.othertest = temp1
ListAddLast list1,temp2


How would I make a method for the type called test2 that would give me access to the fields of the type called test1.

I hope its clear what I am looking for, which is access to field data of a particular external type from within a type. Not sure how else to explain it.


Curtastic(Posted 2005) [#2]
Global list1:TList = CreateList()
Type test1
Field x#, y#, z#
End Type

Global list2:TList = CreateList()
Type test2
Field othertest:test1
End Type

Local temp1:test1 = New test1
temp1.x# = 1.0
temp1.y# = 1.0
temp1.z# = 1.0
ListAddLast list1,temp1

Local temp2:test2 = New test2
temp2.othertest = temp1
ListAddLast list1,temp2

Print temp2.othertest.x



Bremer(Posted 2005) [#3]
I didn't think it would be that simple, but there you go. Thanks for helping out.