Preperly using remove link.

BlitzMax Forums/BlitzMax Beginners Area/Preperly using remove link.

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 ListAddLast method returns a TLink, so if you were to store that, then you could remove it directly using RemoveLink().

So you could setup your type like this:

Type TWords
	Global wordlist:TList

	Field word:String
	Field wlink:TLink

	Function newWord(word:String)
		Local tmp:TWords = New TWords
		tmp.word = word
		tmp.wlink = ListAddLast(wordlist,tmp)
	End Function

	Function remove(tmp:TWords)
		RemoveLink(tmp.wlink)
	End Function
End Type


This is untested, just typed directly, but it might get you further on, otherwise I am sure someone else can pitch in and correct it :)