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.

DarkBASIC Professional Discussion / Any updates regarding arrays within typed arrays?

Author
Message
Zergei
21
Years of Service
User Offline
Joined: 9th Feb 2005
Location: Everywhere
Posted: 26th Feb 2011 15:58
Been doing some searches, trying to find if there was an update that would allow having arrays within other typed arrays, but haven't found anything, either from TGC or a third party developer.

I'm only asking if someone already knows of, either a dll or a set of DBPro function specifically to deal with this issue.

I'm aware that most of the times one can use the approach of multi-dimensional arrays ( example: a[1][1] ), but this is not my case.

Not asking for anyone to cook up some code or anything as such.

The main reason for this post is for me to know if someone has already tackled this issue, as I am creating a set of functions for DBPro that will aid me in dealing with this problem, and I would feel dumb if i re-invent the wheel, when someone already took it's time in developing it first.

Thanks in advance for any help provided.

Further on my stuff at...
TurboSquid.com
The3dStudio.com
IanM
Retired Moderator
23
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 26th Feb 2011 20:00
Not really, though you can simulate them wit (surprise!) one of my plug-ins - unfortunately, with all of the string conversions needed, it won't be as fast as an array would be:


You could also use parallel arrays to provide the same functionality, which would probably be faster.

Westmere
16
Years of Service
User Offline
Joined: 12th Mar 2010
Location: Germany
Posted: 26th Feb 2011 20:28
I use multidimensional arrays, you can set them up outside of your type and use them in conjunction with your type.

Say you want the following:


You could simulate this with multidimensional arrays:



Works in the scenarios I needed it in you just need to make some good remarks to remember what is what. I have no idea how fast this workaround is compared to the one IanM suggested

Zergei
21
Years of Service
User Offline
Joined: 9th Feb 2005
Location: Everywhere
Posted: 27th Feb 2011 16:21
@IanM - I am actually making full use of your plug-in in many ways, and in this functions as well.

@Westmere - That's one interesting way of working with arrays I haven't thought of. I'm concerned, though, if it would be easy or even feasible to resize the arrays.

Thanks to both for providing this examples. I think I'll continue developing this set of functions. After I have something worth showing, I'll post them here for some feedback.

Further on my stuff at...
TurboSquid.com
The3dStudio.com
Zergei
21
Years of Service
User Offline
Joined: 9th Feb 2005
Location: Everywhere
Posted: 27th Feb 2011 23:42 Edited at: 28th Feb 2011 23:32
I got an update on those functions I'm working on.

Managed to create, read and write an Array with diferent data types including other Arrays created from this functions. All there is missing are functions that will allow to delete elements, and I'm gonna take my time on those since i don't want any memory leaks.

By which, I'd like to ask if someone with more expierence could take a look at this functions and see if I'm not missing anything there that would cause a memory leak.
I haven't used pointers so much before and I'm affraid i might have missed something.

Still, here are the set of functions, plus a little example. What do you think?
(Ianm's Matrix Util plug-in requiered)


Edit : Corrected a bug on the code regarding strings.

Further on my stuff at...
TurboSquid.com
The3dStudio.com

Login to post a reply

Server time is: 2026-07-16 01:43:43
Your offset time is: 2026-07-16 01:43:43