what happened to .length in tlists
BlitzMax Forums/BlitzMax Beginners Area/what happened to .length in tlists
| ||
so I want to get the length of a tlist and I thought all you did was thislist: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? |
| ||
you mean:list.count() |
| ||
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?) |
| ||
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 |
| ||
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. |
| ||
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. |