ldoc
ldoc copied to clipboard
function with inline return and errors won't work
trafficstars

In the screenshot above we can see that the doc generated by LDoc 1.4.6 to the right only has the name param. However @error[1], @error[2] and @treturn aren't working.
Steps to replicate:
$ cat multiple.lua
------
-- Various ways of indicating errors
-- @module multiple
----
-- function with inline return and errors
-- @string name
function mul4 (name)
if type(name) ~= 'string' then
--- @error[1] not a string
return nil, 'not a string'
end
if #name == 0 then
--- @error[2] zero-length string
return nil, 'zero-length string'
end
--- @treturn string converted to uppercase
return name:upper()
end
$ ldoc multiple.lua
/private/tmp/ldoc/multiple.lua:11: definition cannot be parsed - not returning function or table
/private/tmp/ldoc/multiple.lua:11: definition cannot be parsed - not returning function or table
/private/tmp/ldoc/multiple.lua:15: definition cannot be parsed - not returning function or table
/private/tmp/ldoc/multiple.lua:15: definition cannot be parsed - not returning function or table
/private/tmp/ldoc/multiple.lua:18: definition cannot be parsed - not returning function or table
/private/tmp/ldoc/multiple.lua:18: definition cannot be parsed - not returning function or table
output written to /private/tmp/ldoc/doc
+1