lua-users home
lua-l archive

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


On 06/09/2017 11:37 PM, Hisham wrote:
> 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.
> 
> [...] above example with odd indentation [...]

Concerning odd indentation. I've found nice ninja indentation trick in
one of World of Warcraft addon:

  if <cond> then do
  end
  [many_lines_of code]
  ...
  end

For someone not closely familiar with Lua syntax it appears that
[many_lines_of_code] logic belongs to main branch, not "if".

-- Martin