Iterating through a StringMap
Monkey Forums/Monkey Programming/Iterating through a StringMap| 
 | ||
| For Local b:Button = Eachin Self.buttons.Object() Next buttons is a StringMap. All I want to do is iterate through the values in the map. What am I doing wrong? | 
| 
 | ||
| Bah...it's buttons.Values().  I wish this was in the docs...  Or probably because I was trying to use Object instead. | 
| 
 | ||
| Edit: Aw, I was ninja'd by you. The Map class doesn't have an "Object()" method. Use the "Values()" method instead, e.g. "Self.buttons.Values()" instead. Either that or Keys and grab each one. I don't usually use maps like you're trying to use them, so I'm not 100% sure of my answer. | 
| 
 | ||
| For Local key:String = EachIn diddyGame.images.Keys() Local i:GameImage = diddyGame.images.Get(key) Next diddyGame.images is a StringMap which contains GameImages. | 
| 
 | ||
| Faster... For Local img:=EachIn diddyGame.images.Values() Next Fastest... For Local it:=EachIn diddyGame.images Local str:=it.Key Local img:=it.Value Next | 
| 
 | ||
| Cool..thanks Mark. | 
| 
 | ||
| I know it's a moot point but would this be even faster? For Local it:=Eachin diddyGame.images it.Value.Update() Next |