how to get next object in a list

BlitzMax Forums/BlitzMax Beginners Area/how to get next object in a list

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

The problem is that you need to check if the link provided by FindLink() exists or not.

edit - simple example (I hope...)

Local the_list:TList = New TList

Type obj
	Field value$
End Type

Local myobj:obj[20]
For i = 1 To 10
	
	myobj[i - 1] = New obj
	myobj[i - 1].value="Hallo "+String(i)
	
	the_list.addlast myobj[i - 1]

Next

For Local iaa:obj = EachIn the_list
	Print iaa.value
Next

Local link:TLink = the_List.FindLink(myobj[1]) 
Local newLink:TLink

If link
	Print "Link exists "+obj(link.value()).value
	newlink = link.NextLink() 
	
	Print "<"+obj(newlink.value()).value+">"
	
Else
	Print "Link doesn't exist"
End If


Try to change FindLink(myobj[1]) with FindLink(myobj[11]) - this link doesn't exist - but you catch the possible error