EachIn

BlitzMax Forums/BlitzMax Beginners Area/EachIn

Several lists of the same data type.
I'm not sure you know but I thought I'd point out that a list can contain any object not just objects of the same type. so:
local g:Tlist=createlist()

local o:myObject=new myObject
local o1:another = new another

listaddlast(g,"hello")
listaddlast(g,o)
listaddlast(g,o1)

for local i:object=eachin g
   if string(i)<>null
      print "it's a string "+string(i)
  elseif myObject(i)<>null
      print "it's a myObject"
  elseif another(i)<>null
      print "it's another."
  endif
next

Hope you get the hang of them, they're handy.