Remove not removing..

BlitzMax Forums/BlitzMax Programming/Remove not removing..

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.

@Perturbatio the list only contain cars in that example.

@Cajun17, RemoveLast() or RemoveFirst() works. But I need to delete a specific object. Still you might be on to the problem. But this does not work either:
		For  Local NR = 1 To List.Count()
			Local C:Car = Car( List.ValueAtIndex(NR) )    
			If C = Null DebugStop()
			If List.Remove(C) DebugLog "Deleted!" Else DebugLog "Not Found!"
		Next
I check the list in the debugger and it does indeed contain two of these very types, C is not null..

I loop a lists of a certain type, like cars. I find the car I want to remove by ID or health or whatever in a simple if-statement. Now I have an object from this list. I take that Object C and remove it from this List: MyList.Remove( C ). That C was <> null or the loop woudn't have looped. But the remove function tells me that object does not exsist in that list?!

There have to be some other factor. I don't know how to continue debugging this. It seems like a paradox. "Found it, but it does not exsist.."