[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Proposal: smartlua
- From: Dirk Laurie <dirk.laurie@...>
- Date: Tue, 12 Mar 2013 09:54:07 +0200
2013/3/12 steve donovan <steve.j.donovan@gmail.com>:
> On a slight tangent, it comes up occasionally, especially
> from former Python users like Dirk,
Will I never live that down? Please emphasize _former_.
> that it would be very useful to have interactive help for
> modules.
I have started doing this: the C function that loads the module
does a "luaL_dostring" on a Lua script with the following text:
~~~
char *mymodule_init =
"print "
"'Welcome to the mymodule library! The following functions are available:'"
"local contents={} "
"for k in pairs(tuple) do contents[#contents+1]=k end "
"table.sort(contents); print(table.concat(contents,' ')) "
;
~~~
As often as not "help" will feature among those functions.
If I don't want that message to appear, I do this:
~~~
keep = print
print = function() return end
mymodule = require "mymodule" end
print = keep
~~~
- References:
- Proposal: smartlua, Stefan Reich
- Re: Proposal: smartlua, steve donovan
- Re: Proposal: smartlua, Christian Bielert
- Re: Proposal: smartlua, steve donovan
- Re: Proposal: smartlua, Peter Drahoš
- Re: Proposal: smartlua, steve donovan
- Re: Proposal: smartlua, Peter Drahoš
- Re: Proposal: smartlua, steve donovan
- Re: Proposal: smartlua, Steve Litt
- Re: Proposal: smartlua, marbux
- Re: Proposal: smartlua, steve donovan
- Re: Proposal: smartlua, mchalkley
- Re: Proposal: smartlua, Peter Drahoš
- Re: Proposal: smartlua, Michal Kottman
- Re: Proposal: smartlua, steve donovan