lua-users home
lua-l archive

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


On Mon, Jun 5, 2017 at 1:17 PM, Roland Yonaba <roland.yonaba@gmail.com> wrote:
> Hi Doe,
>
> I am not aware of any official style guide for Lua. However, there are a
> fair common set of rules that Lua people tend to use and advocate. You can
> find them at:
>
> - Lua Users Style Guide: http://lua-users.org/wiki/LuaStyleGuide
> - Olivine's Lua Style Guide: https://github.com/Olivine-Labs/lua-style-guide
>
> I also recently came across these :
> - Zaki's https://github.com/zaki/lua-style-guide
> - Ykst's fork: https://github.com/ykst/lua-style-guide
>
> Hope these links help.
>
> Regards,
> Roland.

I found your code in Moses very readable and well structured but I
noticed you use '_' for some 'root' level variables (for lack of a
better term). My understanding (I think I read it somewhere)  was '_'
was supposed to be used in cases where you weren't going to use the
value like in:

for k, _ in pairs(tbl) do
--do something with key and not the value
end

Can I ask where you got that syntax from? I ask out of curiosity (and
potential adoption) as it does seem to make your code very
understandable. Any other comments on '_' as a variable name?

Russ

>
>> From: J Doe <general@nativemethods.com>
>> Subject: Lua style guide ?
>
>
>>
>> Hi,
>>
>> I was wondering if there is an official or commonly accepted style guide
>> for Lua ?  I have adopted the same style as Roberto while working through
>> the 3rd and 4th edition of "Programming Lua", but I was wondering if there
>> is an actual written or community followed standard (similar to how Python
>> has PEP-8) ?
>>
>> Thanks,
>>
>> - J
>>
>>
>>
>>
>> ------------------------------
>>
>> Message: 2
>> Date: Fri, 2 Jun 2017 16:38:11 -0400
>> From: J Doe <general@nativemethods.com>
>> Subject: Style guide for Lua ?
>> To: Lua List <lua-l@lists.lua.org>
>> Message-ID: <B077044F-95EB-4808-9A94-7447EE33909E@nativemethods.com>
>> Content-Type: text/plain;       charset=us-ascii
>>
>>
>> Hi,
>>
>> I was wondering if there is an official or commonly accepted style guide
>> for Lua ?  I have adopted the same style as Roberto while working through
>> the 3rd and 4th edition of "Programming Lua", but I was wondering if there
>> is an actual written or community followed standard (similar to how Python
>> has PEP-8) ?
>>
>> Thanks,
>>
>> - J
>>
>>
>>
>> ------------------------------
>>
>> _______________________________________________
>> lua-l mailing list
>> lua-l@lists.lua.org
>>
>> http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/lua-l-lists.lua.org
>>
>>
>> End of lua-l Digest, Vol 83, Issue 4
>> ************************************
>
>