[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: coroutines & timeout
- From: <wiffel@...>
- Date: Wed, 14 Apr 2004 16:23:06 +0200
> > It looks - from your explanation - that using 'userstate'
> and 'hooks'
> > are the prefered way in adding functionality - like the one
> I'm asking
> > - to the LUA VM. Is that correct?
>
> Yes. Aside from the line "if (L->nCcalls > 0) return" you'll
> be working through the API and can thus assume upwards
> compatibility. To add some user state to the lua state
> structure, define the LUA_USERSTATE macro to have something
> prepended (placed below the lua state pointer): you want the
> yield timing to be done on a per-VM-instance basis, so having
> some storage to go with a lua state is handy.
Thanks for this. I'm looking at it right now.
In my 'test', I added the extra info in the 'CallInfo' and not
in the 'lua_State'. I'm not quite sure if that would make a
difference, but I will find out.
> > > Also, coroutines cannot be used from within a resume.
>
> > I'm kind of curious about the 'coroutines cannot be used
> from within a
> > resume'. Maybe I'm just lucky, but the following example works as
> > 'expected' in my test:
>
> My mistake. You're right, they work. I'm doing some further
> stuff that breaks them, and erroneously assumed it was due to
> the hook yielding.
No problem. (Actualy, good for all of us :-)
> Albert-Jan
>
Wilfried Verachtert
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.644 / Virus Database: 412 - Release Date: 3/26/2004