|
| LuaDoc |
| Documentation Generator Tool for the Lua language |
This new version (2.0) is entirely written in Lua. It requires Lua 4.0.
To install LuaDoc, edit luadoc.lua to point to your Lua installation and set LUADOC_HOME variable to point to a directory where LuaDoc files will reside. Then, you may copy all files there.
On Unix boxes, the file luadoc.lua could be used as a script; it's the same as:
lua -f luadoc.lua [options|files]This is the main script: it will load the other files and process the options. Try luadoc.lua --help: this will show you all available options.
The following code defines a function and its documentation.
--- Define special sequences of characters.
-- For each pair (find, subs), the function will create a field named with
-- find which has the value of subs.
-- It also creates an index for the table, according to the order of insertion.
-- @param subs The replacement pattern.
-- @param find The pattern to find.
function def_escapes (find, subs)
local special = { t = "\t", n = "\n", ['"'] = '"', ['\\'] = '\\', }
find = gsub (find, "\\(.)", function (x) return %special[x] or x end)
subs = gsub (subs, "\\(.)", function (x) return %special[x] or x end)
escape_sequences.n = escape_sequences.n+1
escape_sequences[escape_sequences.n] = find
escape_sequences[find] = subs
end
|
|
A good example is the LuaDoc system itself. You can build the documentation by executing the following line from the LuaDoc directory:
luadoc.lua *.luaIt will produce one HTML file for each Lua file and the an index file. You can browse them here.