Linked Lists - How to get first/last items(?)

BlitzMax Forums/BlitzMax Beginners Area/Linked Lists - How to get first/last items(?)

EOF(Posted 2004) [#1]
How do I get the first or last item from a linked list?

Here's an example where I want the first item:
list:TList=CreateList()

Type test
	Field x
End Type

t:test=New test
t.x=123
ListAddLast list,t

t:test=New test
t.x=456
ListAddLast list,t

' ??????
't:test=list.FirstLink()
't:test=list.First()

Print t.x
Again, what about if I want the last item where t might be pointing elsewhere.

What I'm after is similar methods to Blitz3D's First/Last.


Curtastic(Posted 2004) [#2]
.first is the command
you have to convert to test
t:test=test(list.First())


EOF(Posted 2004) [#3]
Thankyou.