List problem
BlitzMax Forums/BlitzMax Beginners Area/List problem
| ||
merkit:TList=CreateList() nimet:TList=CreateList() Local B:String Local C:String ListAddLast merkit,"Fe" ListAddLast merkit,"S" ListAddLast merkit,"P" ListAddLast merkit,"Si" ListAddLast nimet,"Rauta" ListAddLast nimet,"Rikki" ListAddLast nimet,"Typpi" ListAddLast nimet,"Pii" For a$=EachIn merkit Print a$ Next For a$=EachIn nimet Print a$ Next 'How do I easily take third object to "B" from list "merkit" 'and third object from list "nimet" to "C"? Last edited 2010 |
| ||
B = String(merkit.ValueAtIndex(3)) C = String(nimet.ValueAtIndex(3)) |
| ||
Thanks a lot! It was easier than I thought. |
| ||
No probs. Just so you know, ValueAtIndex iterates through the entire list until it gets to the right index. Normally not a problem but the larger the list, the slower it gets. If you're doing this with lists containing hundreds/thousands of objects then you might be better off using an array. |