Can someone tell me why this doesn't work?
Type MyType
Global ListArray:TList[100]
EndType
I'm doing this because I want to have an array inside the MyType namespace rather than in the global namespace.
Thanks
Type MyType
Global ListArray:TList[]
EndType
mytype.listarray = New TList[100]
works but might not do what you want.
that will work for now but this seems like a compiler bug?
This has been fixed in next release.
Cant you use
Field ListArray:TList[100]
??
Thats what I use for a TList in my Types.
Booticus: He wants a single array for the type itself, not one array for each object of the type. Global instead of Field is the equivalent of a Function instead of a Method inside a type, if that's any help.
That's right it's like a singleton.
What I'm doing is organizing things inside a type so they share the "MyType" prefix.
Hopefully the update will be here soon!
Try this:
Strict
Type MyType
Global ListArray:TList[]
EndType
Type MyObject
Field id%
End Type
' Creating lists
MyType.ListArray:TList = New TList[100]
For Local cont%=0 Until 100
MyType.ListArray[cont%] = New TList
Next
' Adding objects
For Local cont%=0 Until 100
Local a:MyObject = New MyObject
a.id% = cont%
MyType.ListArray[cont%].AddLast(a:MyObject)
Next
' Getting objects
For Local cont%=0 Until 100
For Local a:MyObject = EachIn MyType.ListArray[cont%]
Print a.id%
Next
Next
@skid, is this any relation to my problem at
http://www.blitzbasic.com/Community/posts.php?topic=51880 ? It kind of almost seems like a reversed situation of what is here...