[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Pausing a lua script from the C/C++ code.
- From: Brandon <winterknight@...>
- Date: Tue, 8 Jul 2008 07:44:36 -0700
On Tue, 8 Jul 2008 10:30:42 -0400
"Raymond Jacobs" <email@example.com> wrote:
> Hi there,
> Within the add function, you would call lua_yield, and return it's
> return value.
> later you would use lua_resume to resume the thread.
> as for what to pass into lua_yield and lua_resume, I'd suggest you
> read the lua programming reference for those functions
> hope that helps.
Thanks for trying to help, but you seem to have completely missed my
problem. I already know TO use lua_yield and lua_resume. I'm wondering
HOW. As for "reading the reference", I did that before I came here. It
mentions nargs and nresults, but doesn't say what they are. I tried my
best to figure it out, and tried several pieces of code. I have already
explained what I tried in detail. I think that the first missing piece
would be: "return lua_yield(L, 1)". Like I said, I can halt execution
of the script, but can't figure out how to resume it again. I've tried
putting "lua_resume(L, x)" into cont(), where x is everything
reasonable I could think of (I've treid every value between -5 and 10).
I just can't seem to resume it.
I didn't include lua_yield() in the sample code, because I couldn't be
sure that I was doing it right. Perhaps I was yielding in such a way
that I couldn't return.
As for lua_newthread(), I'll look that up.