lua-users home
lua-l archive

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


Hello, I was wondering how luadoc users recommend handling tables as parameters.
Example, let's say I have

function fetch(req)

Where req is a table for specifying a large number of parameters. If I
was manually writing HTML, I would use nested lists:

<h3>fetch(req)</h3>
<div>
   make an asynchronous http request
   <ul>
       <li>req: request configuration table
           <ul>
               <li>host: hostname or ip address</li>
               <li>success: callback to be called with response</li>
               <li>port: (optional) number. default 80</li>
               <li>path: (optional) string. default /</li>
               <li>headers: (optional) table of headers.</li>
               <li>cookies:  (optional) table of cookies.</li>
           </ul>
       </li>
   </ul>
</div>

However in luadoc, I'm not sure how to do nested lists without perhaps
adding a bunch of HTML into my source code (very messy on top of the
already verbose --@param stuff). I could roll my own solution, cut
documentation from source and store it in a seperate lua file, or
manually create documentation. But being able to nest descriptions
seems like a very common use case, given that Lua does not have
keyword arguments. So I was wondering how other luadoc users deal with
this. Or perhaps there is interest in different format, perhaps using
asterisks for nestable parameter lists somewhat similar to markdown
lists:

--Description
--* table_name parameter description here
--  * key_name nested parameter description here
function my_function()
end