How to document a closure with LuaDoc?

468 views Asked by At

Suppose I have a function that returns a closure:

--- Agent constructor
-- @return A function describing the behavior of the agent
Agent = function(data)
   return function(arg1, arg2, ...) end
end

And then I have a variable that receives that closure:

SugarAgent = Agent{ metabolism=5, health=3 }

Is there a standard way in LuaDoc to document the above construction?

1

There are 1 answers

2
Colonel Thirty Two On BEST ANSWER

You can do it by specifying the doc name and type manually:

--- This is a SugarAgent
-- @name SugarAgent
-- @class function
-- @return Some value
SugarAgent = Agent{ metabolism=5, health=3 }

See http://keplerproject.github.io/luadoc/manual.html#tags