lua-users home
lua-l archive

Re: Type Metatables for Table and Userdata - Powerpatch

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


On Fri, Dec 7, 2012 at 9:20 AM, Sven Olsen <sven2718@gmail.com> wrote:
> Or maybe turn it into a value iteration shorthand:>
> foreach v in t --> for _,v in pairs(t)
There's a macro for that ;)
https://github.com/stevedonovan/LuaMacro/blob/master/macro/forall.lua
(LuaMacro used to be based on lhf's generic lexer patch, but the
current lpeg solution allows plain Lua of any variant.)
forall can have an optional if clause
forall x in t if x > 0 do ... end
steve d.

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