[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Lua style guide ?
- From: Martin <eden_martin_fuhrspam@...>
- Date: Sun, 11 Jun 2017 04:36:08 -0700
On 06/09/2017 09:18 PM, Dirk Laurie wrote:
> 1. What will our 'require' return? A function? A table? A userdata?
Function if it exports sole function. Table if exports object or
set of functions.
> 2. Do we locally cache predefined globals?
If it is really (at least 1%) improves final performance.
Or if we wish nicer names for globals.
> 3. How do we code sentinel objects (i.e values that like nil are
> guaranteed not to be equal to anything else)?
Usually "{}". But it was noted it is not secure - you may store
sensitive information in that sentinel table. Other way is
"function() end".
> 4. Do we make big do ... end blocks in our code in order to
> restrict the scope of locals?
Yes if it improves code understanding.
> 5. Do we use some sort of Hungarian notation (i.e. CamelCase,
> quick_brown_fox etc) that advertises what the name will be
> used for)?
Almost no. But "is"/"has" prefix for booleans is nice. And plural
names for arrays/tables ("items").
Words concatenation method in variable names is purely
project-dependent choice. Some prefer oneHumpCamelCase, CamelCase,
vanilla_c, of luastyle ("isyieldable").
> 6. Do we consciously conform to ldoc rules for comments?
May not, unless you are Steve Donovan.
-- Martin
- References:
- Re: Lua style guide ?, Roland Yonaba
- Re: Lua style guide ?, Russell Haley
- 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