lua-users home
lua-l archive

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


Hi,

I have a C coroutine (created with luaL_newthread) that runs a update.lua script updating an array of coroutines. From one of these latest coroutines, I want to stop the C (=root) coroutine and it works (inside a lua coroutine I call a C function that does lua_yield(_thread) ) and later on (when the player answers a question) I want to resume the execution of script.lua to where it was left. I resume the C thread via "lua_resume( _thread , 0);" but then my debugger stops with a segfault at this line in ldo.c:

  if (!f_isLua(ci)) { /* `common' yield? */

Note that it works if the whole process is done outside a lua coroutine.

Is there something I do wrong here ? 
Hope I was clear enough.

thx

Enc: stack trace.

#0 0047115A	resume(L=0x6ac3530, ud=0x7c690b8) (D:\libsC++\lua-5.1.4\src\ldo.c:394)
#1 004703AD	luaD_rawrunprotected(L=0x6ac3530, f=0x471106 <resume>, ud=0x7c690b8) (D:\libsC++\lua-5.1.4\src\ldo.c:116)
#2 0047131C	lua_resume(L=0x6ac3530, nargs=0) (D:\libsC++\lua-5.1.4\src\ldo.c:427)
#3 0047174E	luabind::detail::resume_impl(L=0x6ac3530, nargs=0) (D:\libsC++\luabind-0.9.1\src\pcall.cpp:53)
#4 0040228B	fus::CLuaThread::resume(this=0x6b7bc00) (D:\projets\bc0.2\libs\fusion\scripting\CLuaThread.cpp:63)
#5 00421718	CSinglePlayerState::updateDialog(this=0x6b39240) (D:\projets\bc0.2\src\fightingState\dialog.cpp:265)
#6 0041E6B0	CSinglePlayerState::Update(this=0x6b39240) (D:\projets\bc0.2\src\fightingState\CSinglePlayerState.cpp:233)
#7 004253F0	CGameEngine::Update(this=0x22ea900) (D:\projets\bc0.2\src\game_engine.cpp:961)
#8 00423834	CGameEngine::Run(this=0x22ea900) (D:\projets\bc0.2\src\game_engine.cpp:214)
#9 004270BD	main(argc=1, argv=0x22e3ef0) (D:\projets\bc0.2\src\main.cpp:98)