3

假设我有一个返回闭包的函数:

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

然后我有一个接收该闭包的变量:

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

LuaDoc 中是否有标准方法来记录上述构造?

4

1 回答 1

1

您可以通过指定文档名称并手动键入来做到这一点:

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

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

于 2014-03-08T19:09:29.130 回答