Hi!
just wanted to post a bug.
The add list doesnt seem to work without rediming the element to add.
Point is a type with x and y.
So this does not work:
Dim tmp As point
Dim t As Int
For t = 1 To 10
tmp.x = Rnd(1, 100)
tmp.y = Rnd(1, 100)
wp.Add(tmp)
Log(tmp)
Log(wp.Get(wp.Size-1))
Next
Log("-------")
For t = 0 To wp.Size-1
tmp = wp.Get(t)
Log(tmp)
Next
This works:
Dim t As Int
For t = 1 To 10
Dim tmp As point
tmp.x = Rnd(1, 100)
tmp.y = Rnd(1, 100)
wp.Add(tmp)
Log(tmp)
Log(wp.Get(wp.Size-1))
Next
Log("-------")
For t = 0 To wp.Size-1
tmp = wp.Get(t)
Log(tmp)
Next
I thought this is very strange as I am giving the tmp new values before adding. Is there something I am missing? And in my actual program the adding always results in the entire list having the same value.
Thanks, bye!
just wanted to post a bug.
The add list doesnt seem to work without rediming the element to add.
Point is a type with x and y.
So this does not work:
Dim tmp As point
Dim t As Int
For t = 1 To 10
tmp.x = Rnd(1, 100)
tmp.y = Rnd(1, 100)
wp.Add(tmp)
Log(tmp)
Log(wp.Get(wp.Size-1))
Next
Log("-------")
For t = 0 To wp.Size-1
tmp = wp.Get(t)
Log(tmp)
Next
This works:
Dim t As Int
For t = 1 To 10
Dim tmp As point
tmp.x = Rnd(1, 100)
tmp.y = Rnd(1, 100)
wp.Add(tmp)
Log(tmp)
Log(wp.Get(wp.Size-1))
Next
Log("-------")
For t = 0 To wp.Size-1
tmp = wp.Get(t)
Log(tmp)
Next
I thought this is very strange as I am giving the tmp new values before adding. Is there something I am missing? And in my actual program the adding always results in the entire list having the same value.
Thanks, bye!
Last edited: