I have run into a problem solving a problem mentioned in an earlier post (the problem with multiple instantiations). My problem is I would like to create an array of arrays (something possible with VB but apparently not in PB). I need the ability to create (dynamically) x number of arrays of unknown sizes. For Example:
I have a function which can be called an unknown number of times, and with each unique call of that function I need to set up some data storage. I would like to create a master Data-Storage array with each element being an array of actual data being stored. This approach would allow me to continually redim preserve the array allowing it to grow as needed.
With each init call of this function, I would add a new element array of data to the master array.
My question is, what is the best (and easiest) way to implement something like this in PowerBasic? Any and all suggestions/advice is welcomed!
Thank you in advance for your help.
Best regards,
Andrew Peskin
[email protected]
------------------
I have a function which can be called an unknown number of times, and with each unique call of that function I need to set up some data storage. I would like to create a master Data-Storage array with each element being an array of actual data being stored. This approach would allow me to continually redim preserve the array allowing it to grow as needed.
Code:
Val1 = MyFunc(5,Init) Val2 = MyFunc(7,Init) . . . Val9 = MyFunc(25,Init)
Code:
ReDim DataStorage(1:1) ReDim DataStorage(1).(1:5) ReDim Preserve DataStorage(1:2) ReDim DataStorage(2).(1:7) . . . ReDim Preserve DataStorage(1:9) ReDim DataStorage(9).(1:25)
Thank you in advance for your help.
Best regards,
Andrew Peskin
[email protected]
------------------
Comment