Audio migration in progress. Some responses pages / audio files may have broken file links.

Help:Extensions/Scribunto/Style Guide

From Dota 2 Wiki
Jump to: navigation, search
 
 
 
Style Guide
 
Illusory Orb icon.png
▶️ We are in accord.
This page has been marked for an open review.
Please see the discussion page for additional information, your opinion is welcome.

Layout[edit]

Example[edit]

local p = {}

local cargo = mw.ext.cargo
local calc = require('Module:Calculate')


function example()
  -- Some code here.
end


return p

Indentation[edit]

Use 2 spaces per indentation level.

Continuing lines should be aligned vertically.

Good:

  function(arg1, arg2,
           arg3)

Bad:

  function(arg1, arg2,
    arg3)

White space[edit]

Use white space generously in your code.

Use 2 blank lines to separate functions from the package table/imports. Use single blank lines to separate individual functions.

Imports[edit]

Requirements should always be at the top of a script and ordered alphabetically, to make them immediately obvious.

List extensions (e.g. mw.ext.cargo) before required modules.