lua-users home
lua-l archive

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


On Tue, Jul 8, 2008 at 10:25 AM, Brandon <winterknight@nerdshack.com> wrote:
> Thanks for the help, Raymond. I've looked into co-routines and
> lua_newthread, and they don't look like what I want. I think I might be
> on the wrong track with lua_yield and lua_resume.

yes they are.

you just have to understand how to use coroutines.  for that, it's a
lot easier to start with a small prototype using Lua only (no C).
when you get the feel of how coroutines work, it won't be hard to use
them from C.

for starters, a coroutine is like a function that can yield() instead
of return. after that, you can resume() it and it'll continue right
after the yield()

-- 
Javier