[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: text source of compiled functions
- From: Luiz Henrique de Figueiredo <lhf@...>
- Date: Tue, 27 Jul 1999 08:28:35 -0300 (EST)
>From email@example.com Tue Jul 27 07:58:15 1999
>From: David Jeske <firstname.lastname@example.org>
>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"?
There's no official API for this, but you can look inside ldo.c and luac.c
and see how it's done: "lua_parsestring" would be luaY_parser;
"lua_doblock" would be luaD_protectedrun.
>I'd prefer to prevent any side-effects as
>a result of just bringing in a module.
Well, the whole point of loading a chunk is to have some side-effects!
(At least, some function definitions, which are simply assignments.)
Now, as you say, "chunks" are probably different from what you call "modules".
But I think Lua has the mechanisms to allow you to define your own semantics
for "modules", e.g., the setglobal tag method.