- Notifications
You must be signed in to change notification settings - Fork1
Extracts lua documentation from C-style comments
License
rhys-vdw/lua-doc-extractor
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Extracts lua documentation from C-style comments.
$ npm install -g lua-doc-extractor
/*** * Main API * @table Api * @field Version integer*//*** * The absolute path to the executable. * @global ExecutablePath string*//*** * @enum NameType * @field FirstName 1 First name. * @field LastName 2 Last name.*//*** * @field NameType.FullName 3 Full name, including middle names.*//*** * Get name by ID * @function Api.GetName * @param id integer The integer of the person. * @param nameType NameType Which name to return. * @return string name The full or first name of the person.*/intSomeClass::GetName(lua_State *L){
---@meta---Main APIApi= {---@typeintegerVersion=nil}---The absolute path to the executable.---@typestringExectablePath=nil---@enumNameTypeNameType= {--- First name.FirstName=1,---Last name.LastName=2,---Full name, including middle names.FullName=3}---Get name by ID------@paramidinteger The integer of the person.---@paramnameTypeNameType Which name to return.---@returnstring name The full or first name of the person.functionApi.GetName(id,nameType)end
Process files:
$ lua-doc-extractor some-file.cpp other-files/*.cpp --dest outputShow usage:
$ lua-doc-extractor --help
To add GitHub source links to the exported library. Provide the--repo argument.
$ lua-doc-extractor**/*.cpp --dest library --repo https://github.com/beyond-all-reason/spring/blob/62ee0b4/
Lua docs in document comment blocks (/*** <docs> */) will be parsed.
Alllua language server annotations can be used, some with special handling. Some additional annotations are required by lua-doc-extractor.
@global <name> <type> [description]Defines a global variable.
@field <name> <type> [description]Add fields to a table (@table,@class or@enum) by including them in the same comment.
@field <table>.<name> <type> [description]You can also add fields to a table defined in a different comment.
@function <name> [description]Defines a global function.
@function <table>.<name> [description]@function <table>:<name> [description]Adds a function to a@table or@class defined in a different comment.
Should be paired with@param,@return and@generic attributes.
@table <name>Defines a global table. Fields can be added with@field.
@enum <name>Defines a global table marked with the@enum attribute. Entries can be added with@field.
@class <name>Defines a class. Fields can be added with@field, methods can be added with@function.
PRs accepted.
MIT
About
Extracts lua documentation from C-style comments
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.