AddList / removeList
BlitzMax Forums/BlitzMax Beginners Area/AddList / removeList
| ||
Hi. I have an object of type TBall (called PlayerBall) and a list of TBalls (called ballList). What I'd like to do is swap playerBall with the first in the list of ballList. (so playerBall becomes first in the list of BallList and the first object in BallList now becomes PlayerBall). To copy the first in the list of BallList I have done this: I'm getting some strange results and I'm assuming its down to what I'm doing here? thanks |
| ||
i didnt think you could do that... playerBall=TBall(ballList.removefirst()) i dont think it returns an object ... what you will need todo is playerball = tball(balllist.first()) balllist.removefirst() ... of course i coould be wrong and you could just do a null test on playerball |
| ||
But isnt that just adding playerBall to the first position in the list and then instantly removing it? (as its in first position after adding it)? EDIT Crap, of course its not - but its just copying the first in the list to playerBall and then removing it(without adding playerBall to ballList). I guess this would be the solution: |
| ||
but it works :D edit: oh, ok np |
| ||
thanks for the help! |