Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Need help 2 dimensional dynamic array

Author
Message
mr Handy
12
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 22nd Aug 2013 16:11
Hi! I need help with arrays.
Here is the code for 2 dimensional dynamic array that doesn't work:

Anyone, please?

Rudolpho
14
Years of Service
User Offline
Joined: 28th Dec 2005
Location: Sweden
Posted: 22nd Aug 2013 19:06
I don't think you can use list operations (insert / remove) on multi-dimensional arrays.
You can re-dimension them though.



I haven't used this in a while, but I remember that it at least did use to work a few years ago.


"Why do programmers get Halloween and Christmas mixed up?"
TheComet
12
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 22nd Aug 2013 20:08
@ mrHandy - Check this out, it might be of interest (I had a similar problem)

http://forum.thegamecreators.com/?m=forum_view&t=198891&b=1

TheComet

mr Handy
12
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 23rd Aug 2013 19:57 Edited at: 23rd Aug 2013 19:58
So it can't be resized, only re-created? I am sure that when recreating 2 dimensional array it keeps values because... it is a bug? Therefore, 3 dimensional clears because it is not. Or otherwise?

So I think I will leave the idea with multidimensional arrays and write a script to read values from file...

TheComet
12
Years of Service
User Offline
Joined: 18th Oct 2007
Location: I`m under ur bridge eating ur goatz.
Posted: 23rd Aug 2013 21:10 Edited at: 23rd Aug 2013 21:11
Quote: "I am sure that when recreating 2 dimensional array it keeps values because... it is a bug?"


Yeah, I think it feels very unsafe too. Also, it will delete strings in UDTs if you re-create a 2D array, so...

Here's another idea for multi-dimensional arrays:

1) make a temporary array
2) copy old array into temporary array
3) delete old array
4) make new array again, but larger
5) copy temporary array back into new array
6) delete temporary array

I know it sucks.

Sometimes you don't always need multi-dimensional arrays, can't you compress it?

This here:


Is the same as this:


TheComet

mr Handy
12
Years of Service
User Offline
Joined: 7th Sep 2007
Location: out of TGC
Posted: 23rd Aug 2013 21:27
Quote: "Is the same as this:"

How can i enlarge or shrink this "compressed" array?

Login to post a reply

Server time is: 2020-01-20 18:37:40
Your offset time is: 2020-01-20 18:37:40