[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: text source of compiled functions
- From: David Jeske <jeske@...>
- Date: Tue, 27 Jul 1999 03:45:42 -0700
On Tue, Jul 27, 1999 at 06:53:24AM -0300, Luiz Henrique de Figueiredo wrote:
> >From firstname.lastname@example.org Tue Jul 27 01:54:42 1999
> >From: Pablo Saldo <email@example.com>
> >Is there a way to retrieve the code in a passive way, without executing any
> I'm not sure what you mean here.
> lua_dostring always executes the string it gets, but this execution can be
> simply the definition of some functions, eg:
I'll restate the question as: If we define lua_dostring as:
a_block = lua_parsestring(a_string)
How do we do "lua_parsestring" and "lua_doblock"?
I'm guessing that the closest you can get is to build the
tokenizer/compiler stuff in as a function, "compile" from source to
bytecodes first, and then "lua_dostring" the bytecodes as necessary.
Although I must admit that I've always disliked the whole
"lua_dostring()" interface. I'd prefer to prevent any side-effects as
a result of just bringing in a module. As a result, I use my own Perl
style 'require()' function which keeps track of module loads, and from
which I have always intended to enforce some concept of
namespaces/context. (i.e. make global variables "module-global" only)
David Jeske (N9LCA) + http://www.chat.net/~jeske/ + firstname.lastname@example.org