lua-users home
lua-l archive

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


Юрий Соколов wrote:
>   L1 = lua_newthread(L);

You cannot yield from a thread in LuaJIT 1.x if you don't give it
its own C stack. The standard coroutine.create() and coroutine.wrap()
functions already do this for you. Rewrite your example in pure Lua
code and you'll see it works out-of-the-box.

If you want to create Lua threads from C (not recommended, it's not
faster), you need to read this: http://luajit.org/coco_api.html
Scroll down to lua_newcthread().

--Mike