lua-users home
lua-l archive

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

Eike Decker <zet23t <at>> writes:

> I wished I could simply set one hook for all coroutines, but it looks
> like that this is not possible - and I don't believe that this is
> "need to have" feature for Lua, since this is quite a special
> situation.
> What would you suggest?
> Eike

If you aren't opposed to using a custom version of Lua, I might try running each
bot in its own Lua VM, then modifying the VM itself to wait every XX
instructions.  I think you could do this by having a counter at the top of the
for(;;) in luaV_execute that would run the specified number of instructions,
notify the controller that it is done, then sleep until it was told to run again.

I don't know how this would work in practice, but that is how I would probably
try to tackle the problem.