Domanda

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?

È stato utile?

Soluzione

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

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top