Hello,
I have two lua scripts which represents levels.
Each time a level is loaded it's respective StartLevel script
is called in another thread like this:
lua_State
*thr = lua_newthread(LuaMain);
lua_getglobal(thr,
"StartLevel");
lua_pcall(thr,
0, 0, 0);
In first script I'm trying to call C function
(StartExplosion) and then I want to wait until it's over.
After that I'm trying to start that coroutine again to load
another level (LoadLevel) function.
I've tried returning lua_yield() from StartExplosion function
and then calling lua_resume from main game loop after 10s have
elapsed, but it doesn't work at all.
It seems that I need to use lua_pcallk but there is no
example how to use it, can you please help me by writing a small
example?
Or is it done in a completely different way?
my lua function looks like this:
**level1.lua**
function StartLevel
StartExplosion();
LoadLevel("level2.lua");
end
**level2.lua**
function StartLevel
print("hello");
end
Thanks!