-
Couldn't load subscription status.
- Fork 80
Style guide
Not strictly enforced, but we appreciate if you try to remain consistent with our standards.
-
Include at least a brief one-line summary in a LuaDoc (a comment with 3 dashes
---) before each public-facing function -
A LuaDoc with extended summary,
@params, and@returnis encouraged. (LuaDoc Manual) -
All names (for everything: files, functions, variables, etc) are fully lower case with underscores separating words (
snake_case). There are 2 notable exceptions: dependencies start with upper case letters for each word and have no spaces (CamelCase). In addition, any table or variable beingreturned by a file can start with an upper case letter. -
Tabs are 4 spaces
-
Try to keep each line of code to a readable length. Under 140 characters when reasonable.
-
Never leave trailing whitespace.
-
End each file with a newline.
-
Newlines are unix
\n -
Strings should normally be encased in
'single-quotes. For strings with single quotes inside them,"double-quotes can be used. -
Use spaces around operators, after commas, colons, and semicolons.
sum = 1 + 2
a, b = 1, 2
if 1 < 2 then
game.print('Hi')
end- No spaces after
(,[,{or before],),}.
table = {1, 2, 3}
table[1]- Use empty lines between
functionsand to break up functions into logical paragraphs.
local function some_function()
local data = global.data
local format = global.string_format
local string = Utils.manipulate(data, format)
game.print(string)
end
local function say_hello()
game.print('Hello')
end- When creating a table over multiple lines, do not include a trailing comma after the last item.
my_table ={
'item1',
'item2',
'item3'
}- When creating commands, hyphens
-are the standard word separator for the command's name.
Having issues? Reach out on discord
Got a bug report, feature request or map idea? Open an issue
Looking to download maps? See releases or the public save directory
Interested in Localization? Check out the progress at Crowdin