lua-users home
lua-l archive

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


On Tue, 8 Jul 2008 10:30:42 -0400
"Raymond Jacobs" <raymondj@gmail.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
> 
> http://www.lua.org/manual/5.1/
> 
> hope that helps.
> 
> -Raymond

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.

-Brandon