lua-users home
lua-l archive

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


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.
>
> Milind
 
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.



Denne e-posten er fri for virus og uønsket programvare fordi avast! Antivirus beskyttelsen er aktiv.