lua-users home
lua-l archive

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


Hello,

I would like to implement a kind of "help" function,
that would return a string documenting the function,
taken from the function source code (like Python
docstrings...).

Maybe someone already tried ?

For Lua functions, I think a possible solution would
be to use the debug library (debug.getinfo) to find
the source file and to extract a kind of "docstring" out
of the function code.

Of course it will not be possible to do the same for
functions defined at runtime (for example if someone
does "f=function() return 'HELLO' end" no docstring
can be extracted...)...

And what about C functions ?
If I write a Lua library with C functions, I have no idea
how I could get a "docstring" out of it.

Any ideas ?

Thanks in advance!!!