lua-users home
lua-l archive

Re: Filtering Iterator

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


2012年12月22日 Kevin Martin <kev82@khn.org.uk>:
> I need an iterator wrapper/decorator I can use with for that allows
> me to skip values that don't match a specified predicate. I've done
> a bit of searching, but haven't been able to find one.
Is there a reason why the obvious Lua code is inefficient, obscure
or not applicable?
for k,v in iterator do if predicate(v) then
 -- code
end end

AltStyle によって変換されたページ (->オリジナル) /