[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Type Metatables for Table and Userdata - Powerpatch
- From: steve donovan <steve.j.donovan@...>
- Date: Fri, 7 Dec 2012 09:34:34 +0200
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.