#Naming Conventions
Both Lua and Objective-C portions of an extension/plugin should contain in-line documention of all of the functions they expose to users of the extension/plugin.
The format for docstrings should follow the standard described below.
#Documentation Rules
- Any comment that starts with
---
or///
is a doc-string (i.e. 3 comment-characters in a row) - Doc-strings continue on until a non-docstring line
- Doc-strings for modules contain
=== my.modulename ===
, then any number of lines describing it - Doc-strings for items (functions, variables, etc.) go like this:
- The first line starts with
my.modulename.item
ormy.modulename:item
-- this is the item name - Any non-alphanumeric character ends the item name and is ignored, i.e. parentheses or spaces:
my.modulename:foo()
my.modulename:foo(bar) -> string
my.modulename.foo(bar, fn(int) -> int)
my.modulename.foo = {}
- The second line is a single capitalized word, like "Variable" or "Function" or "Method" or "Constant" or "Field"
- The remaining lines describe the item
- The first line starts with
- Any comment that starts with 4 comment-characters is ignored
- Only files ending in
.lua
or.m
are scanned
#Constants
#Variables
#Fields
For example:
#Functions
Note that a function is any API function provided by an extension, which doesn't relate to an object created by the extension.
The Parameters
and Returns
sections should always be present. If there is nothing to describe there, simply list * None
. The Notes
section is optional and should only be present if there are useful notes.
#Methods
Note that a method is any function provided by an extension which relates to an object created by that extension. They are still technically functions, but the signature is differentiated by the presence of a :
The Parameters
and Returns
sections should always be present. If there is nothing to describe there, simply list * None
. The Notes
section is optional and should only be present if there are useful notes.
#Example Plugin
Here is an example of how plugins should be structured: