|
I am wondering whether anyone can point me in the
direction of some document, or atleast let me know whether there is some way of
calling a function in from c that will allow me to halt the lua vm whilst
executing a chunk, if any, and then return from the routine (such as
lua_pcall) which called lua to execute that chunk, and then at a later
point in time continue the execution from where it was halted. I have seen the
lua_yeild and lua_halt functions. But i am not sure whether they would allow me
to do this on the main lua thread. If anyone can clarify this then please let me
know. i am not too worried if the yeilding or whatever doesn't take effect until
lua is executing lua opcode, ie doesn't yeild in a c function. i just want to be
able to load and execute a chunk with an infinite service loop, then
jumping out of the lua land every ms or so that i can service some devices, and
then go back to lua from where it left off. short of implementing a thread
manager on my ucontroller this is the only idea i have had to allow a single
threaded c application to happily co-exist with lua. timers are plentiful so
calling the yeild function is not a problem. if this is not possible, or would
be a major taken then i will just put together a simple thread
manager.
Cheers,
Andrew Stanley
Teirney
|