LunaLua style guide

From Moondust Wiki
Revision as of 23:01, 27 March 2018 by The0x539 (talk | contribs) (Create page)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Whitespace

do
	-- Indent with tabs.
	local myVar    = 1 -- Optionally align. If aligning, use spaces.
	local otherVar = 2
	local someTbl = {
		"tables split across",
		"multiple lines should",
		"look like this"
	}
end

Comments

--------------------
-- SECTION HEADER --
--------------------

-- Prose comments, either on their own line or after code, have a space after the double-dash.

--- LDoc-compatible function description.
-- Optional additional description lines.
-- @param foo first parameter
-- @param bar second parameter
function doAThing(foo, bar)
	return foo + bar
end