Can someone please tell me if the following is possible? I can't seem to get my test code to work.
Say I have a UDT:
TYPE MyType
myField as INTEGER
ENDTYPE
I also have an init function to create a global array to be used to store a bunch of those types. I treat the array as a list later. The init function is called early in the program:
function init()
global dim myTypeList(0) as MyType
endfunction
Lastly, I want another function that can dynamically add a type to the list:
function newMyType()
m as MyType
array insert at top myTypeList(0)
myTypeList(1) = m
endfunction
The problem is that the array does seem to be growing, but I can't seem to access any of its contents by doing something like:
m2 as myType
m2 = myTypeList(0)
print str$(m2.ID)
Any ideas? Is this even possible? Is it a scoping problem because I'm creating the type var inside a function? Is it not possible to create UDT dynamically?
Would love you feedback, thanks!
--skyser