2 .\" Copyright (c) 2018 Kyle Evans <kevans@FreeBSD.org>
3 .\" All rights reserved.
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\" notice, this list of conditions and the following disclaimer in the
12 .\" documentation and/or other materials provided with the distribution.
14 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 .\" ARE DISCLAIMED. IN NO EVENT SHALL [your name] OR CONTRIBUTORS BE LIABLE
18 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 This file specifies the preferred style for lua source files in the
40 Many of the style rules are implicit in the examples.
41 Be careful to check the examples before assuming that
43 is silent on an issue.
45 The copyright header should be a series of single-line comments.
46 Use the single-line comment style for every line in a multi-line comment.
48 After any copyright header, there is a blank line, and the
50 comment for non-C/C++ source files.
52 The preferred method of including other files and modules is with
58 config = require("config");
59 menu = require("menu");
60 password = require("password");
61 -- One blank line following the module require block
67 Indentation and wrapping should match the guidelines provided by
69 Do note that it is ok to wrap much earlier than 80 columns if readability would
72 Statements should be terminated with a semicolon.
74 should not be terminated with a semicolon.
80 This is applicable to objects with methods.
81 String are a commonly-used example of objects with methods.
85 should be done explicitly, rather than as a boolean expression.
86 Single-line conditional statements and loops should be avoided.
89 variables should be preferred to global variables in module scope.
91 Multiple local variables should not be declared
93 initialized on a single line.
94 Lines containing multiple variable declarations without initialization are ok.
95 Lines containing multiple variable declarations initialized to a single function
96 call returning a tuple with the same number of values is also ok.
100 be done at declaration time as appropriate.
104 This manual page is inspired from the same source as