lua-users home
lua-l archive

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

On 6/17/07, Leonardo Maciel <> wrote:
> however this is the place I would call "lua_to_user" with the
You mean "c_to_user", right?

Yes, that is what I meant, sorry about that.

If I understand your problem correctly, one of many ways to do it. Not the
most elegant, but the easiest to explain that I can think of is:

 * Redirect the output to a temporary file.
 * Run this (not tested) code snippet once during initialization.

I was afraid this was going to be the answer. My own solution was
similar, except that I changed the io parameters inside the script
itself with a variable passed from the C code. Still, this solution to
me seems to be far too wasteful of system resources, even if you
continually removed the file(s) after the output was parsed. I guess
that's what the /tmp folder is for, though...
I don't suppose (without getting into threads) that there is any other
way to solve this issue? I was sort of hoping there was a set of
official Lua library functions that allowed this behavior. Of course,
I understand the futility of trying to embedd compiled C code into a
Lua script, but it seems to me that some sort of dynamic loading
system could be/has been devised for just such a problem.
Oh well, back to the stone ages with me, I guess. Thanks, Leonardo!