|
Scratch that. I see now that the
return value of lua_resume() has changed between 5.1 and 5.0.2. My code was interpreting non-zero (i.e. LUA_YIELD)
as an error code as per the 5.0.2 documentation. From:
lua-bounces@bazar2.conectiva.com.br
[mailto:lua-bounces@bazar2.conectiva.com.br] On
Behalf Of Brian Hassink Actually, I’ve determined that
lua_resume() is not failing but rather my script is aborting after a call is made
to lua_yield(thread, 0) from a C-function invoked by the script. Has something changed in the yield
behavior for threads? From:
lua-bounces@bazar2.conectiva.com.br
[mailto:lua-bounces@bazar2.conectiva.com.br] On
Behalf Of Brian Hassink The following (simplified) sequence works under 5.0.2… lua_State* thread = lua_newthread(L); refKey = luaL_ref(L, LUA_REGISTRYINDEX); lua_pcall(thread, 0, 0, 0); lua_getglobal(thread, "main"); lua_pushnumber(thread, id); lua_resume(thread, 1); …but under 5.1 the call to lua_resume() fails, and
lua_tostring(thread, -1) returns an inconsistent numerical value (in the range
of 0 through 60). Is there something about this sequence that is no longer
valid under 5.1? Thanks, Brian |