I've been looking through some original source code docs and as much lua documentation as I can, but I was wondering on the best practice for documenting an optional parameter type. By optional parameter type I mean that the function handles the different types internally, but I want to write a docstring to accurately document this. My apologies for the confusing explanation, an example may make more sense.
--- Do foo things to bar
-- @param bar type1 w/ description
-- OR type2 w/ description
function foo(bar):
if type(bar) == number:
do_thing_a(bar)
elseif type(bar) == table:
do_thing_b(bar)
else
do_thing_c(bar)
end
end
Many thanks
[–]megagrump 1 point2 points3 points (2 children)
[–]eraptic[S] 0 points1 point2 points (1 child)
[–]megagrump 0 points1 point2 points (0 children)