| 1 |
Lua coding style for the graphdrawing library |
| 2 |
============================================= |
| 3 |
|
| 4 |
General naming rules and indentation: |
| 5 |
|
| 6 |
* 2 spaces indentation |
| 7 |
* variable_names_with_underscores |
| 8 |
* namespaced.low_level_functions_with_underscores(foo, bar) |
| 9 |
* CamelCaseClassNames |
| 10 |
* CamelCaseClassNames.nameOfStaticFunctionLikeNewOrClone(foo, bar) |
| 11 |
* CamelCaseClass:functionNamesLikeThis(foo, bar) |
| 12 |
* never use global variables |
| 13 |
* Use . for static functions and : for member functions |
| 14 |
|
| 15 |
LuaDoc comments: |
| 16 |
|
| 17 |
--- |
| 18 |
-- A function to do this and that. |
| 19 |
-- |
| 20 |
-- @param first Description of the first parameter. |
| 21 |
-- @param second Description of the second parameter. |
| 22 |
-- |
| 23 |
-- @return This function returns something. |
| 24 |
-- |
| 25 |
function myClass:myFunction(first, second) |
| 26 |
... |
| 27 |
end |