Module:Codedoc

--| Reads a file and outputs its comments. --b Pedro M. Rabinovitch  --$Id: dofile.lua,v 1.2 2003/10/20 03:35:08 miller Exp $ -- Wikifying by Dessamator require 'proc_src' insp = require ("inspect").inspect function createDocs local opt = { complete = true, proc_private = true }	local docOutput = "" local fin

fin = io.open("a.lua","r") local text = fin:read('*a') local cmt = ProcLua:process( text, opt ) docOutput = "Script information\n" .."\nAuthors: ".. cmt.header.authors[1] .."\nPurpose: ".. cmt.header.purpose .."\nRevision: ".. cmt.header.revision .."\nTodo: ".. (cmt.header.todo[1] or "") .. "\n"

for _, objDetails in pairs(cmt.functions) do docOutput = docOutput .. "\n\nFunction: ".. objDetails.name .. "\nParameters \n" docOutput = docOutput .. "Name:\tType\tpurpose\n" for paramName, paramDetails in pairs(objDetails.parameters) do docOutput = docOutput .. paramDetails.name .."|\t" .. paramDetails.purpose .. "|\t" .. paramDetails.type .."\n" end for _, returnDetails in pairs(objDetails.returns) do docOutput = docOutput .. "Returns\n".. "Type: " .. returnDetails.type .. "\n".. "Purpose : " ..returnDetails.purpose end end

print (docOutput) fin:close end

createDocs