[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: ipairs_remove - remove items from array while iterating it
- From: Francisco Olarte <folarte@...>
- Date: Sun, 3 Nov 2013 11:40:30 +0100
Hi:
On Sun, Nov 3, 2013 at 7:36 AM, Philipp Janda <siffiejoe@gmx.net> wrote:
> If creating an updated copy instead of removing elements in-place is
> acceptable, I'd suggest the slightly more general `imodify` function which
> can replace/remove/insert before/insert after the current element:
If you can spare enough memory for a copy of a list, you can do
anything you want by just processing it sequentially inserting
whatever you need in a temp one, linear time, and then copying the
temp into the original, linear time again, with any type of array
which is not passed by value ( like deep copying, not passing a
pointer-like thing by value ), like lua tables ( C++ containers are
the only ones that come to mind which can be easily passed by value ).
Francisco Olarte.