News : The level of daily SPAM has reached insane proportions, all registrations are now manual. I ask you to send me an e-mail (john (at) murga (dot) org), to confirm that you want me to create an account for you.

Post Reply  Post Thread 
table reset
Author Message
Senior Member

Posts: 522
Group: Registered
Joined: Apr 2007
Status: Offline
Reputation: 5
Post: #1
Question  table reset

I'm working on a script that loads external scripts into it, and trying to figure out the best way to handle arbitrary variable names and memory usage. What I have at the moment is a table in the main script into which the external script loads its variables and functions.

In order to reset that table's contents to nil in preparation for the next loaded script, I could use a loop to remove all of its elements individually. Or I could simply recreate the table as a new empty table (overwriting the previous one). What I'm wondering is does the latter approach clear the previous table's contents from memory? I'm not sure it does...for example, if you create two widgets which have the same variable name, both of those widgets remain visible and interactive even after a redraw. Maybe there's a better way than either of these two ideas?

I've found that assigning the table's name to a new empty table causes the old table.var to return nil, but does that mean the old data is necessarily purged from memory?

This post was last modified: 12-04-2010 01:51 AM by mikshaw.

12-04-2010 01:37 AM
Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

Messages In This Thread
table reset - mikshaw - 12-04-2010 01:37 AM
RE: table reset - jpjacobs - 12-04-2010, 11:16 AM
RE: table reset - mikshaw - 12-04-2010, 01:37 PM

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites

Forum Jump: