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,11 +42,13 @@ 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]
if l then
local fctname local fctname
_, _, fctname = l:find("^(.+)%(lua_State") _, _, fctname = l:find("^(.+)%(lua_State")
if fctname then if fctname then
function_doc[fctname] = comment 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
@ -67,7 +69,7 @@ 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())