-
Notifications
You must be signed in to change notification settings - Fork 382
CodeDocumentationStyle
Toby edited this page Mar 16, 2016
·
4 revisions
To unify the comments that describe the functions, the following style is suggested.
You can either use a block comment or line comments. With a block comment:
--[[ One line description for the function f.
! Other description lines can be added here, wrapping multiple lines
against the left border.
!param name (type) The description of the parameter. Also mention special values with their meaning.
...
!return (type if possible) Description of the return value.
]]
function f(name)
Or with line comments:
--! One line description for the function f.
--! A longer description can be added here, wrapping multiple lines against the left border.
-- If the longer description has multiple lines, only the first line of the long description has the
-- exclamation mark symbol (!). The other lines only need Lua's syntax for comment line (--).
--!param name (type) The description of the parameter. Also mention special values with their meaning.
--!...
--!return (type if possible) Description of the return value.
function f(name)
//! One line description of the function f.
/*!
@param name Description of the parameter. Note that type of the parameter
is not needed. Also mention special values with their meaning.
...
@return Description of the return value.
*/
int f(int name)
First, install ''DoxyGen'' and ''LDocGen'' for C/C++ and Lua documentation respectively. Reference documentation can be generated with:
cd $repo_root
cmake .
make doc
Generated documentation can be found in $repo_root/doc