Mercurial > prosody-hg
annotate doc/coding_style.txt @ 9659:86c431650dfd
net.websocket.frames: Prefer Lua 5.2 built-in bit module over LuaJIT version
When running on Lua 5.2 this makes sense since bit32 is usually already
loaded. It's sensible to prefer this going forward in case of
incompatibilities between the two variants.
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Thu, 29 Nov 2018 16:53:22 +0100 |
| parents | 41c959c5c84b |
| children |
| rev | line source |
|---|---|
| 13 | 1 This file describes some coding styles to try and adhere to when contributing to this project. |
| 2 Please try to follow, and feel free to fix code you see not following this standard. | |
| 3 | |
| 4 == Indentation == | |
| 5 | |
| 6 1 tab indentation for all blocks | |
| 7 | |
| 8 == Spacing == | |
| 9 | |
|
8728
41c959c5c84b
Fix spelling throughout the codebase [codespell]
Kim Alvefur <zash@zash.se>
parents:
13
diff
changeset
|
10 No space between function names and parenthesis and parenthesis and parameters: |
| 13 | 11 |
| 12 function foo(bar, baz) | |
| 13 | |
| 14 Single space between braces and key/value pairs in table constructors: | |
| 15 | |
| 16 { foo = "bar", bar = "foo" } | |
| 17 | |
| 18 == Local variable naming == | |
| 19 | |
| 20 In this project there are many places where use of globals is restricted, and locals used for faster access. | |
| 21 | |
| 22 Local versions of standard functions should follow the below form: | |
| 23 | |
| 24 math.random -> m_random | |
| 25 string.char -> s_char | |
| 26 | |
| 27 == Miscellaneous == | |
| 28 | |
| 29 Single-statement blocks may be written on one line when short | |
| 30 | |
| 31 if foo then bar(); end | |
| 32 | |
| 33 'do' and 'then' keywords should be placed at the end of the line, and never on a line by themself. |
