AutoHotkey Community

It is currently May 27th, 2012, 12:43 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: March 1st, 2010, 12:39 am 
Offline

Joined: November 26th, 2009, 3:00 am
Posts: 13
For example, I'm using a global variable array. When I am done storing items, I no longer want them to exist in the global namespace. Currently I am freeing their data with the following code:

Code:
VarSetCapacity(array%i%, 0)


While this does get rid of the data they store, they still exist in the global namespace as is evident by the fact that when you go to "View variables and their contents", you still see them there. For example, you would see:

Code:
array1[0 of 0]: 
array2[0 of 0]: 
array3[0 of 0]: 
array4[0 of 0]: 


Which seems like it's just wasting space. Thanks for the help.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 1st, 2010, 12:51 am 
You would need to do something like:

Code:
Loop, %i%   ; "i" being the maximum number in your array
  array%a_Index% =


If there's a better way, I'd sure like to see it myself. But this works great...as long as you don't have 12,987 items in your array. I haven't yet, but you never know :wink: .

DBM


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 1st, 2010, 1:17 am 
Offline

Joined: November 26th, 2009, 3:00 am
Posts: 13
Thanks for trying to help, however, this has the same exact problem where the variable is still present in the list of global variables.

If you add:
Code:
ListVars
Pause


You will see that the variables still exist after that code.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 1st, 2010, 3:16 am 
Offline
User avatar

Joined: December 21st, 2007, 3:14 pm
Posts: 3826
Location: Louisville KY USA
once a variable is created in ahk it exists untill the script ends.... why does this matter ?

_________________
No matter what your oppinion Please join this discussion
Formal request to Polyethene
Image


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: chaosad, jrav and 23 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group