another list question
BlitzMax Forums/BlitzMax Beginners Area/another list question
| ||
here's my code.Function addscore() Local score:tscore=New tscore list.addlast score score.score=trock.score score.level=tship.level list.sort(True) If list.count()>10 list.RemoveLast score End Function My question is-will this remove the last score or will it remove the score I just added?This is a function in my type.I have an override method for the list.sort to sort it by score. |
| ||
The one you added will be at the end of the list, so it will be the one removed. *EDIT* I should learn to read :) Whatever one is at the end of the list after the sort will be removed. BTW you dont pass anything to removelast, just List.removelast(), maybe that whats confusing you. |
| ||
First, the last line should be thisIf list.count()>10 list.RemoveLast 'without the score And yes,after sort,the last object in the list is deleted,not last added.(unless it's the lowest score) Thanks, mudcat |