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

From Xenharmonic Wiki
Jump to navigation Jump to search
Ganaram inukshuk (talk | contribs)
No edit summary
Ganaram inukshuk (talk | contribs)
No edit summary
Line 41: Line 41:
=== Spacing ===
=== Spacing ===
Use a space after <code>--</code>, used for comments. The lack of a space after <code>--</code> should indicate commented-out code.
Use a space after <code>--</code>, used for comments. The lack of a space after <code>--</code> should indicate commented-out code.
== Mediawiki table formatting ==
One line per cell, not one line per row.
{| class="wikitable"
|+
!Header 1
!Header 2
!Header 3
|-
|aa
|bb
|cc
|-
|dd
|ee
|ff
|}

Revision as of 02:03, 29 November 2024

Parts of it are adapted to follow editing on the wiki.

Lua style

The following style guide is a provisional guide adapted from the LuaRocks style guide: https://github.com/luarocks/lua-style-guide

Indentation and formatting

Use the default as specified by the in-browser Lua editor.

Documentation

to be determined

Variable names

Same as LuaRocks style guide.

Tables

Same as LuaRocks style guide.

Strings

Same as LuaRocks style guide.

Do not escape double-quotes when a string can be enclosed in single-quotes instead. Only escape double-quotes when a string contains both single and double quotes.

Line lengths

to be determined

Function declaration syntax

Same as LuaRocks style guide

Function calls

Same as LuaRocks style guide.

Use of wrapper functions

Allowed.

Table attributes

to be determined

Blocks

to be determined

Spacing

Use a space after --, used for comments. The lack of a space after -- should indicate commented-out code.

Mediawiki table formatting

One line per cell, not one line per row.

Header 1 Header 2 Header 3
aa bb cc
dd ee ff