lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Sun, Nov 3, 2013 at 7:36 AM, Philipp Janda <> 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.