[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: ipairs_remove - remove items from array while iterating it
- From: "David Hamill" <david@...>
- Date: Sun, 3 Nov 2013 11:49:07 -0000
Francisco Olarte wrote:
If you can spare enough memory for a copy of a list, you can do anything
you want by just processing it sequentially ...
First post here. :-)
I'm new to Lua, but I've used Perl a lot; and Perl is also an interpreted
language that uses tables ("hashes" or associative arrays) as a major data
structure. My approach would be to copy the original table to a new one,
leaving out the unwanted entries. Then the old table can be discarded, and
hopefully it will be garbage-collected in due course.
If plenty of memory is available, why not make use of it? But if memory is
tight, one might not be able to afford the luxury of two large tables.