lua-users home
lua-l archive

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

On Fri, Jan 14, 2011 at 02:30, Drake Wilson <> wrote:
> Quoth Emmanuel Oga <>, on 2011-01-14 01:12:40 -0300:
>> Is there any other more elegant way?
> There's not much that's "elegant" in the sense of "easy using the Lua
> table library" or such, that I can see.  If I were coding it all the
> way down, I'd do something like this:
> [snip]

I've submitted a variant of your code to LuaSnippets[1]. My function
removes a element according to the predicated, instead of keeping it.
The function is optimized to avoid unnecessary table assignments by
finding contiguous slots "marked" as to-be-kept.