[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua style guide ?
- From: Sean Conner <sean@...>
- Date: Sat, 10 Jun 2017 02:51:00 -0400
It was thus said that the Great Hisham once stated:
> On 10 June 2017 at 03:02, Sean Conner <sean@conman.org> wrote:
> >
> > It was thus said that the Great Dirk Laurie once stated:
> > > 4. Do we make big do ... end blocks in our code in order to
> > > restrict the scope of locals?
> >
> > I do that quite often. In fact, I'll do things like:
> >
> > local somevar do
> > -- code to do a bunch of stuff
> > somevar = ...
> > end
> >
> > to make it clear that there is some non-trivial initialization of a local
> > variable.
>
> Dirk talked about using do-end blocks to restrict the scope of locals,
> but the above example with odd indentation does not do that.
Took some time, but I found an example that I could give (code that wasn't
written at work):
local cmdline do
local C = lpeg.C
local P = lpeg.P
local SP = P" "
local token = C((P(1) - P" ")^1)
cmdline = SP^0 * token * (SP * C(P(1)^0))^-1
end
-spc (Better?)
- References:
- Re: Lua style guide ?, Peter Aronoff
- Re: Lua style guide ?, Hisham
- Re: Lua style guide ?, Edu Araújo
- Re: Lua style guide ?, Sean Conner
- Re: Lua style guide ?, steve donovan
- Re: Lua style guide ?, Dirk Laurie
- Re: Lua style guide ?, Hisham
- Re: Lua style guide ?, Dirk Laurie
- Re: Lua style guide ?, Sean Conner
- Re: Lua style guide ?, Hisham