[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Coroutine debug hook counter
- From: Dolphin <dhawkins@...>
- Date: Mon, 2 Mar 2009 21:36:40 +0000 (UTC)
Eike Decker <zet23t <at> googlemail.com> 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
> What would you suggest?
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.