4

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?

Daniel
  • 645
  • 7
  • 11

1 Answers1

1

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

Colonel Thirty Two
  • 23,953
  • 8
  • 45
  • 85
  • I'm actually trying to document the AgentSugar function, but your answer came pretty close to what I'm looking for. – Daniel Mar 10 '14 at 13:32
  • Sorry, it's actually `@class`, not `@type` (see http://keplerproject.github.io/luadoc/manual.html#tags). Someone tried to edit the post with the correct information, but the edit was rejected because it was 'incorrect.' Sigh. – Colonel Thirty Two Mar 12 '14 at 14:14