User:Ganaram inukshuk/Provisional style guide for Lua: Difference between revisions

Ganaram inukshuk (talk | contribs)
mNo edit summary
Ganaram inukshuk (talk | contribs)
mNo edit summary
Line 10: Line 10:
=== Naming and declaring variables ===
=== Naming and declaring variables ===


Variable names should be short and descriptive, written in <code>snake_case</code>. Exceptions to this include counter variables, like with <code>i</code> in for loops. Boolean variables are prefixed with <code>is_</code> wherever possible. Constants are named using <code>TRAIN_CASE</code>.
Variable names should be short and descriptive, written in <code>snake_case</code>. Exceptions to this include counter variables, like with <code>i</code> in for loops. Boolean variables are prefixed with <code>is_</code> or <code>has_</code> wherever possible. Constants are named using <code>TRAIN_CASE</code>.


All variable declarations should start with <code>local</code>.
All variable declarations should start with <code>local</code>.
Line 48: Line 48:
=== Naming, declaring, and calling functions ===
=== Naming, declaring, and calling functions ===


As with variables, functions are named using <code>snake_case</code>. Functions that return a boolean variable are prefixed with <code>is_</code>''.''
As with variables, functions are named using <code>snake_case</code>. Functions that return a boolean variable are prefixed with <code>is_</code> or <code>has_</code>.


''tbd''
''tbd''