lua-users home
lua-l archive

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


Op 20 februari 2012 08:56 schreef steve donovan <steve.j.donovan@gmail.com> het volgende:

I tend to say 'ldoc -m ml' which does the same thing on the command
line.  But for interactive use, help() would be useful, especially if
there was a docstring convention.

On my computer, `ldoc` is not a known command.  Considering myself to be
a mature programmer whose hand does not need to be held all the time, I did
_all_ of the following:

1. Installed ldoc by way of LuaRocks.
2. Noted with interest that Penlight is installed as a dependency (Microlight
    users almost by definition wouldn't want that)
3. Searched for ldoc.lua, finding it eventually in an eighth-level directory.
4. Made an executable calling it (on a Linux machine, that means changing its mode, inserting a first line that says it should be run as a Lua script, and linking it symbolically to ~/bin/ldoc.  On a Windows machine, I presume it means making LDOC.BAT.)
5. Ran 'ldoc -m ml' and got a message about an invalid escape sequence.
6. Remembered why that happens and changed the first line to say it's a Lua5.1 script.
7. Got the required docs, all 30-odd lines of it.  Also got on stderr:
ml.lua:217: ml.tdump: param and formal argument name mismatch: '...' 'f'
ml.lua:383: ml.import: param and formal argument name mismatch: '...' 'other'
which I ignored.
8. Noted with interest that function_arg is not there.
9. Wrote the attached module `mldoc`. 
10. Rewarded myself with a cup of coffee.

A note on "mldoc": it adds "help" and "wrap" to ml.  For optimal convenience, do this:

    require "mldoc"
    require "ml".import()
 
Then "help" and "wrap" are also imported.

It will not have escaped your notice that "wrap" is being proposed as top-30 material.

Dirk