2013-08-24 15:19:45 +02:00
|
|
|
------
|
|
|
|
-- Various ways of indicating errors
|
|
|
|
-- @module multiple
|
|
|
|
|
|
|
|
-----
|
|
|
|
-- function with return groups.
|
|
|
|
-- @treturn[1] string result
|
|
|
|
-- @return[2] nil
|
|
|
|
-- @return[2] error message
|
|
|
|
function mul1 () end
|
|
|
|
|
|
|
|
-----
|
|
|
|
-- function with return and error tag
|
|
|
|
-- @return result
|
|
|
|
-- @error message
|
|
|
|
function mul2 () end
|
|
|
|
|
2013-08-26 09:59:10 +02:00
|
|
|
-----
|
|
|
|
-- function with multiple error tags
|
|
|
|
-- @return result
|
2013-08-26 13:37:41 +02:00
|
|
|
-- @error not found
|
|
|
|
-- @error bad format
|
2013-08-26 09:59:10 +02:00
|
|
|
function mul3 () end
|
|
|
|
|
2013-08-26 14:22:52 +02:00
|
|
|
----
|
|
|
|
-- function with inline return and errors
|
|
|
|
-- @string name
|
|
|
|
function mul4 (name)
|
|
|
|
if type(name) ~= 'string' then
|
2013-08-27 12:47:47 +02:00
|
|
|
--- @error[1] not a string
|
2013-08-26 14:22:52 +02:00
|
|
|
return nil, 'not a string'
|
|
|
|
end
|
2013-08-27 12:47:47 +02:00
|
|
|
if #name == 0 then
|
|
|
|
--- @error[2] zero-length string
|
|
|
|
return nil, 'zero-length string'
|
|
|
|
end
|
2013-08-26 14:22:52 +02:00
|
|
|
--- @treturn string converted to uppercase
|
|
|
|
return name:upper()
|
|
|
|
end
|
2013-08-24 15:19:45 +02:00
|
|
|
-----
|
|
|
|
-- function that raises an error.
|
|
|
|
-- @string filename
|
|
|
|
-- @treturn string result
|
|
|
|
-- @raise 'file not found'
|
2013-08-26 14:22:52 +02:00
|
|
|
function mul5(filename) end
|