2019-01-08 22:13:52 +11:00
|
|
|
local tA = {...}
|
|
|
|
local docfiles = {}
|
|
|
|
for _,file in pairs(tA) do
|
|
|
|
docfiles[file] = {}
|
|
|
|
local f = io.open(file)
|
|
|
|
local lines = {}
|
|
|
|
for l in f:read("*a"):gmatch("[^\n]+") do
|
|
|
|
if l:find("function") and not l:find("local") then
|
|
|
|
lines[#lines+1] = l
|
|
|
|
end
|
|
|
|
end
|
|
|
|
for k,v in pairs(lines) do
|
|
|
|
local name, args, desc = v:match("function%s+(.+)%s*%((.*)%)%s*%-%-%s*(.+)")
|
|
|
|
if name and args and desc then
|
2020-05-12 10:49:51 +10:00
|
|
|
docfiles[file][#docfiles[file]+1] = string.format("## %s(%s)\n%s\n",name,args,desc)
|
2019-01-08 22:13:52 +11:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
for k,v in pairs(docfiles) do
|
|
|
|
if #v > 0 then
|
2020-05-12 10:49:51 +10:00
|
|
|
print("\n# "..k)
|
2019-01-08 22:13:52 +11:00
|
|
|
for l,m in pairs(v) do
|
|
|
|
print(m)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|