lua-src: fix a bug if l is nil, add , as optional

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-06-26 22:43:37 +02:00
parent 2cdfb71f15
commit fc509e4d16
1 changed files with 12 additions and 10 deletions

View File

@ -42,16 +42,18 @@ for i, line in ipairs(ilines) do
elseif line:find("%*/") then elseif line:find("%*/") then
comment_start = false comment_start = false
local l = ilines[i + 2] local l = ilines[i + 2]
local fctname if l then
_, _, fctname = l:find("^(.+)%(lua_State") local fctname
if fctname then _, _, fctname = l:find("^(.+)%(lua_State")
function_doc[fctname] = comment if fctname then
function_doc[fctname] = comment
end
end end
comment = nil comment = nil
elseif comment_start then elseif comment_start then
if not line:find("\\param") and not line:find("\\return") and not line:find("\\luastack") then if not line:find("\\param") and not line:find("\\return") and not line:find("\\luastack") then
comment = comment .. "\n" .. line comment = comment .. "\n" .. line
end end
end end
end end
@ -67,12 +69,12 @@ for i, line in ipairs(ilines) do
libname = nil libname = nil
else else
local fctname, fctdef local fctname, fctdef
_, _, fctname, fctdef = line:find("\"(.+)\", (.+) },") _, _, fctname, fctdef = line:find("\"(.+)\", (.+) },?")
if fctname and not fctname:find("^__") then if fctname and not fctname:find("^__") then
if function_doc[fctdef] then if function_doc[fctdef] then
print(function_doc[fctdef]:comment_translate()) print(function_doc[fctdef]:comment_translate())
print("function " .. libname .. "." .. fctname .. "()") print("function " .. libname .. "." .. fctname .. "()")
print("end"); print("end");
else else
print("This function is not yet documented.") print("This function is not yet documented.")
end end