Type elements disappearing?

Blitz3D Forums/Blitz3D Programming/Type elements disappearing?

cyberyoyo(Posted 2005) [#1]
Are there known problems causing some elements of a collection to disappear?
I check them at one moment and they are ok and a moment after some of the elements have vanished.
My code is fairly long so I can't post it here but There are absolutely no delete statements inside.
What's more puzzling is that some variables assigned to these elements still hold them although I don't see them when I make a for each loop
Any idea?


Beaker(Posted 2005) [#2]
It is very much more likely to be something odd you have in your code than a problem with Blitz itself.

Something to look out for: are you using the variable for the Each loop anywhere else in the loop? This could lead to skipping of items.


Shifty Geezer(Posted 2005) [#3]
I haven't had any problems. I think Blitz is so mature now such errors would have been found out long ago. More likely you're overwriting/skipping an element of a type. When I get weird behaviour it's because, when I eventually find it, I'm doing something earlier on with an object that messes up it's later access.


Curtastic(Posted 2005) [#4]
I've only encountered this once, but It will delete the one you pass to a function, if the function uses it in a foreach loop and you use it in a foreach loop afterwards.
Type t
	Field x
End Type

a.t=New t
a\x=2

a.t=New t
a\x=5

b.t=New t
b\x=6

hi(a)

Print
For a.t=Each t
	Print a\x
Next

WaitKey
End

Function hi(z.t)
	For z=Each t
		Print z\x
	Next
End Function



cyberyoyo(Posted 2005) [#5]
Corrorae , I think you are describing exactly my problem, I wil investigate further.


Curtastic(Posted 2005) [#6]
Just make sure you aren't doing this:
Function DoSomething(g.guy)
	For g=Each guy



cyberyoyo(Posted 2005) [#7]

Just make sure you aren't doing this:
Function DoSomething(g.guy)
	For g=Each guy




That indeed was the problem. It took me a little while to find the faulty functions.
Thanks everybody for your answers