ldoc icon indicating copy to clipboard operation
ldoc copied to clipboard

Function with a formal argument with more than one possible type

Open FredrikKarlssonSpeech opened this issue 7 years ago • 0 comments

Hi,

Lua allows for arguments of different type to be supplied to a function, but I cannot get this to work with @tparam of Ldoc.

-- @tparam boolean shouldRun A truth value. If evaluated to 'true', then the function will be run and the delay imposed.
-- @tparam func toRun The function ...
-- @tparam {int} toRun Ff instead an array is passed to the function, ...
-- @tparam int sleepSeconds Optional number of .....
function runIf(shouldRun, toRun, sleepSeconds )
...
end

should, I think, be fine but Ldoc returns this:

... bhall.lua:857: runIf: param and formal argument name mismatch: 'toRun' 'sleepSeconds'
... bhall.lua:857: runIf: extra param with no formal argument: 'sleepSeconds'

which indicates that this is not working. What can I do?

FredrikKarlssonSpeech avatar Oct 15 '17 18:10 FredrikKarlssonSpeech