dumb way to remove stuff, seeking smart way

BlitzMax Forums/BlitzMax Programming/dumb way to remove stuff, seeking smart way

The following functions are part of a Type. When I create an object, I also give it an ID (Field). When I remove an object from the list, I use this ID: I loop through the whole list, until I find the ID, and then I remove it.

But, is this really neccessary? It seems a dumb way of doing it. Can't I just directly remove list item 4 or 6 for example? Does a list come with an "ID" internally?

Thanks.

	Function removeByID(id)
		For Local p:plaatje = EachIn plaatje.plaatjesList
			If p.id = id 
				p.removeObject() 
				Return
			End If
		Next

		Print "Could not remove object with id "+id+". Not found."
		End

	End Function

	Method removeObject()
		ListRemove plaatjesList,Self
	End Method