[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Turning an entire script into a coroutine
- From: Michael Abbott <mabster@...>
- Date: Sun, 20 Feb 2005 02:26:31 +1100
Rici Lake wrote:
Of course, you could do the same thing from C. The easiest way to do it
is to just brute force turn the above code into C, but a cleaner
solution is to write your own chunk reader and use lua_load. There is a
slight difference between the Lua coroutine library and the C coroutine
API, though: read the reference manual carefully.
Aaaah, it took a bit of playing around with the lua functions to figure
out what you're doing there. It all makes sense now :-)
The added advantage of putting a wrapper around the function from the C
end is that you can put all your library sandboxing in the prefix too
:-) Nice!
- Mab