Milind Gupta wrote:
> I had written a small C module to allow running multiple Lua scripts by
> executing each one for a certain number of steps, also allowing data passing
> from the parent script to the child scripts. But it uses hooks in the C API.
> It is here http://www.neukleus.com/LuaStepper.html
I'm doing something similar, only with a simpler implementation, using lua_newthread() and yielding from the debug hook. It works fine, executing any Lua function as a timesliced thread and allowing multiple such threads to run with the script. There are some snags; the global thread isn't timesliced, and I can't currently actual Lua coroutines don't cooperate fully. The reason I posted about this is that I think it would be nice if Lua supported cooperative timeslicing of the VM in a general and efficient manner.