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.

AppGameKit Classic Chat / Question about Array[n].remove

Author
Message
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 14th May 2017 00:01
If I have a complex array of types and dynamically generated sub arrays, do I need to clean these up recursively if the master array item is removed?

Say I have a master array consisting of


Would I need to go and clear out the Occupied[] array and the myShortlist[] arrays first or would they be deallocated?
I know I need to delete objects, images, tweens etc. which I've generated and yes, if they are generated in the sub-arrays I will need to go clean them up, but what about the array data itself?

Richard_6
7
Years of Service
User Offline
Joined: 3rd Feb 2017
Location:
Posted: 15th May 2017 04:25
Hi nz0! I've worked on something recently. Not sure if its thats what you're looking for but here we go:

nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 15th May 2017 19:42
Hi Richard,

I was talking about if the sub arrays get de-allocated automatically or would you have to do it manually (like in your example)
Paul Johnston
TGC Developer
22
Years of Service
User Offline
Joined: 16th Nov 2002
Location: United Kingdom
Posted: 17th May 2017 16:27
All sub arrays should be freed automatically when you delete an item from an array.
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 17th May 2017 18:38
Quote: "All sub arrays should be freed automatically when you delete an item from an array."

not saw it in docu at "Array Declaration and Resizing"
AGK (Steam) V2017.05.15 : Windows 10 Pro 64 Bit : AMD (17.4.4) Radeon R7 265 : Mac mini OS Sierra (10.12.2)
nz0
AGK Developer
17
Years of Service
User Offline
Joined: 13th Jun 2007
Location: Cheshire,UK
Posted: 17th May 2017 20:21
Thanks Paul - glad to hear that.
The array commands are really quite powerful. I think that the help doesn't cover enough explanations though.

For instance, I eventually worked out how to pass a sub array type pointer into a function.

I like the maintained sorting, but it would be cool to specify the sorting member, although not massively important.
Got to say it's making my development a lot easier for sure.

Login to post a reply

Server time is: 2024-11-24 13:23:26
Your offset time is: 2024-11-24 13:23:26