what happened to .length in tlists

BlitzMax Forums/BlitzMax Beginners Area/what happened to .length in tlists

Nate the Great(Posted 2009) [#1]
so I want to get the length of a tlist and I thought all you did was this

list:TList = New TList

Local value:Object

list.addlast(value:Object)

Print list.length


but it always says "identifier length not found." im obviously doing something stupid here. Anyone know how to get the length of a tlist?


Jesse(Posted 2009) [#2]
you mean:
list.count()



Czar Flavius(Posted 2009) [#3]
Count goes through the list one by one to count - if speed is an issue it might be better to maintain your own count, when things are added and removed. (Or has that been fixed?)


Nate the Great(Posted 2009) [#4]
oh woops! lol I was thinking of arrays :p I just havent used that method in soo long I was just sure it had to be length. thanks


plash(Posted 2009) [#5]
Count goes through the list one by one to count - if speed is an issue it might be better to maintain your own count, when things are added and removed. (Or has that been fixed?)
It has not been fixed as far as I know. I use an extension for TList to track the count via a field instead of iteration.


Jesse(Posted 2009) [#6]

I use an extension for TList to track the count via a field instead of iteration.


did you do a work around for link.remove() to get a correct count also?
I might end up doing it your way and work that out too.

to find out if there are objects in the list, I use IsEmpty() which is pretty fast.