[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Implementing help function (like in Python)
- From: "Wesley Smith" <wesley.hoke@...>
- Date: Fri, 14 Sep 2007 14:10:06 -0700
When you say it's easy in C#, how would this be any different from C++?
On 9/14/07, Stefan Sandberg <email@example.com> wrote:
> It's very easy and elegant in C#..
> Matias Guijarro wrote:
> > 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!!!