3

As the title says, how to use luadoc in ubuntu/linux? I generated documentation in windows using batch file but no success in ubuntu. Any ideas?

luadoc
Usage: /usr/bin/luadoc [options|files]
Generate documentation from files. Available options are:
  -d path                      output directory path
  -t path                      template directory path
  -h, --help                   print this help and exit
      --noindexpage            do not generate global index page
      --nofiles                do not generate documentation for files
      --nomodules              do not generate documentation for modules
      --doclet doclet_module   doclet module to generate output
      --taglet taglet_module   taglet module to parse input code
  -q, --quiet                  suppress all normal output
  -v, --version                print version information
hjpotter92
  • 78,589
  • 36
  • 144
  • 183
Chhabilal
  • 1,076
  • 11
  • 22
  • Did you try `/usr/bin/luadoc [options|files]`? What went wrong? – Bartek Banachewicz Jul 05 '13 at 14:46
  • This doesn't appear to be programming related and would probably be better suited to either http://askubuntu.com/ or http://superuser.com – Mgetz Jul 05 '13 at 14:46
  • Hi, I tried but getting error: lua5.1: ./luadoc/doclet/html.lua:224: could not open `index.html' for writing stack traceback: [C]: in function 'assert' ./luadoc/doclet/html.lua:224: in function 'start' /usr/share/lua/5.1/luadoc/init.lua:49: in function (tail call): ? /usr/bin/luadoc:121: in main chunk [C]: ? – Chhabilal Jul 05 '13 at 14:51
  • yeah Megtz, you maybe right...but would be nice if you/somebody who managed to generate lua documentation in linux platform could explain me in details what the parameters refer to? – Chhabilal Jul 05 '13 at 16:02
  • and ***the command used*** that gave that error? – greatwolf Jul 05 '13 at 16:40
  • yes, the command used gave that error – Chhabilal Jul 05 '13 at 16:43
  • btw, how you write the launcher script luadoc.lua? – Chhabilal Jul 05 '13 at 16:47
  • @user2554162 No, **what** is the command used that gave that error? – greatwolf Jul 05 '13 at 17:05
  • i solved the problem, anyway thanks guys, if anybody needs help with this topic please let me know – Chhabilal Jul 11 '13 at 12:38
  • I have [installed it with luarocks](http://stackoverflow.com/questions/41203830/how-to-run-luadoc) under Windows but where is `luadocs` so I can run it? – Stefan Falk Dec 17 '16 at 23:00

1 Answers1

2

First off, I have little experience with Luadoc, but a lot of experience with Ubuntu and Lua, so I'm basing all my points off of that knowledge and a quick install that I've just done of luadoc. Luadoc, as far as I can see, is a Lua library (so can also be used in Lua scripts as well as bash). To make documentation (in bash), you just run

luadoc file.lua

(where file is the name of your file that you want to create documentation for)

The options -d and -t are there to choose where you want to put the file and what template you want to use (which I have no clue about, I'm afraid :P). For example (for -d):

luadoc file.lua -d ~/Docs

As far as I can see, there is little else to explain about the actual options (as your code snippet explains what they do well enough).

Now, looking at the errors you obtained when running (lua5.1: ... could not open "index.html" for writing), I'd suggest a few things. One, if you compiled the source code, then you may have made a mistake somewhere, such as not installing dependencies (which I'd be surprised about, because otherwise you wouldn't have been able to make it at all). If you did, you could try getting it from the repos with

sudo apt-get install luadoc

which will install the dependencies too. This is probably the problem, as my working copy of luadoc runs fine from /usr/bin with the command

./luadoc

which means that your luadoc is odd, or you're doing something funny (which I cannot work out from what you've said). I presume that you have lua5.1 installed (considering the errors), so it's not to do with that.

My advice to you is to try running

luadoc file.lua

in the directory of file.lua with any old lua file (although preferably one with at least a little data in) and see if it generates an index.html in the same folder (don't change the directory with -d, for testing purposes). If that DOESN'T work, then reinstall it from the repos with apt-get. If doing that and trying luadoc file.lua doesn't work, then reply with the errors, as something bigger is going wrong (probably).

finnbar
  • 46
  • 5
  • @displayname I don't use Windows, so I don't know. However, [this post](http://stackoverflow.com/questions/15033719/how-to-use-luadoc-with-luaforwindows) has something on it, although it's installed with Lua For Windows rather than LuaRocks so I don't know if that's helpful. It's probably not on the system path or something, in which case you'll have to add it somehow (again, I'm not a Windows user). – finnbar Dec 18 '16 at 17:12