From 84c309ac5a6db4efbac4fe9610dad2c5f47921ec Mon Sep 17 00:00:00 2001 From: mrkubax10 Date: Sat, 11 Mar 2023 19:18:58 +0000 Subject: [PATCH] Some updates to CODING_STYLE.md --- CODING_STYLE.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/CODING_STYLE.md b/CODING_STYLE.md index f0f07dd..0627137 100644 --- a/CODING_STYLE.md +++ b/CODING_STYLE.md @@ -5,7 +5,24 @@ You should use tabs for indentation. ## Naming convention Use `lowerCamelCase` for functions, variables and table keys. Use `UPPER_SNAKE_CASE` for constants and `lower_snake_case` for filenames. -## Other +## Blocks +Keywords used to open blocks (i.e. `then`, `do`) should go to the same line as the statement: +```lua +if condition then + ... +end +``` +or: +```lua +while condition do + ... +end +``` + +## Variables +General rule is to keep as much variables local as possible. If variable must be global then it should go to `industrialtest` table also under subnamespace if appropriate (the same applies to functions). + +## Tables If table contains one element then it can be inlined: ```lua someTable={element}