lua-users home
lua-l archive

Re: Documenting modules with LuaDoc in Lua 5.2

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Monday 06 December 2010 3:51:07 pm James Graves wrote:
> 
> I've had to mess around a little to get luadoc working properly in
> this situation.
> 
> Here's what I've got at the top of one of my files:
> 
> 
> --- Infinite Lists.
> -- <br />
> -- Various ways to construct infinite lists.
> -- @class module
> -- @name infinite_list
> 
> --[[ The module line is needed for luadoc to consider this a module.
> module "infinite_list"
> ]]--
> 
> local M = {} -- List of exported functions.
> 
> 
> The 'module' declaration is necessary, but commented out. The @class
> and @name tags are also necessary.
> 
> >From there I define my functions. Since the exported functions are
> defined as M.foo (to put them in the exported table), I also have to
> put in a @name tag.
> 
> BR,
> 
> James
Thank you for sharing this. I didn't realize that LuaDoc didn't recognize multi-line comments, which allows a much cleaner way of declaring modules than I had. 
The example you show works perfectly for me. But it also seems to pick up the module name fine even without using the "@name" tag in the module documentation comment. 
Peter

AltStyle によって変換されたページ (->オリジナル) /