Monkey and List Nodes
Community Forums/Monkey Talk/Monkey and List Nodes
| ||
Can anyone give me an example how to use the list nodes? I would like to remove a specific object from my list but there is no command top do that except using nodes. But when i try to use them monkey complains that the word Node is a duplicate in both the list module and the map module. It doesnt matter if I use strict mode or not. I use the demo version if thats important v.30 |
| ||
I normally remove objects from a list like this:Class Bullet Global list:List = new List<Bullet> Field x#, y# .... For local b:Bullet = EachIn Bullet.list If b.y < 0 Then Bullet.list.Remove(b) End if Next |
| ||
Be aware that the (List) Remove method iterates through the entire list, looking for matching values to remove (so the code in post #2 has time O(n^2) ). It's the simplest way but isn't appropriate for performance. Last edited 2011 |
| ||
|
| ||
Thanks alot degac :) Works perfectly Last edited 2011 |