TList cannot be invoked

BlitzMax Forums/BlitzMax Beginners Area/TList cannot be invoked

Matt McFarland(Posted 2006) [#1]
    If CountList(K_E_HighScoreList) > 10
    	For Local purge = 11 To CountList(K_E_HighScoreList)
    	      Local purgee:THighScore = THighScore(K_E_HighScoreList(purge))
    	Next
    End If

I'm trying to grab specific types in a list by their indexed number.
The error is coming from this line:
Local purgee:THighScore = THighScore(K_E_HighScoreList(purge))

Any ideas?


Dreamora(Posted 2006) [#2]
yeah problem is that you need .valueatindex(purge) instead of simply purge.

But this is a very bad idea with lists as it will have to go step by step through the list even with an index. convert it to array (arrayfromlist) first and do index based operation on an array


Matt McFarland(Posted 2006) [#3]
Thanks Dream! I dont think its a bad idea considering its only done at very specific instances.


Dreamora(Posted 2006) [#4]
If your list is not altered after beeing filled or only in rare cases, then converting is a very usefull thing. (if you need to modify it rarely, you can create a list from array again for that task and reconvert to array afterwards)