lua-users home
lua-l archive

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


Hi!

Yeah it will work...

But i wiil be pain in the ass for gamedesigners to script an object..

Ex: 

I want:

	While true do

		Goto(WayPointA)
		Goto(WayPointB) 	
		Goto(WayPointC)
		Goto(WayPointD)	
		PlayAndWaitAnim("dummyanim")
	end

Goto & PlayAndWaitAnim automatically yields if necessary...


with your solution it will be :

	While true do

		while Goto(WayPointA) do
 		end
		while Goto(WayPointB) do
 		end
		while Goto(WayPointC) do
 		end
		while Goto(WayPointD) do
 		end
		while PlayAndWaitAnim("dummyanim") do
 		end
		
	end

not really "friendly" for poor gamedesigners....

but thanks...

JC


-----Message d'origine-----
De : lua-bounces@bazar2.conectiva.com.br
[mailto:lua-bounces@bazar2.conectiva.com.br] De la part de David Given
Envoyé : vendredi 22 octobre 2004 14:53
À : Lua list
Objet : Re: PATCH: true C coroutines -- yield across C stack from anywhere

On Friday 22 October 2004 13:40, Jean-Christophe Capdevila wrote:
[...]
> What i want to do is that when the C function WaitEvent is called, it
> yields the coroutine..
> That is working perfectly, but i want the coroutine to restart at the
> function WaitEvent and not the line after ( index = index + 1 )...
> In  this way, each time i call a resume on the coroutine, the same C
> function is called and decide if coroutine must yield and stay at it, or
> continue it's execution..

Could you just do:

 while WaitEvent() do
 end

...? So your C function returns true if it wants WaitEvent to be called
again, 
and false if it wants execution to continue?

-- 
+- David Given --McQ-+ "I've just had a terrible thought --- what if all
|  dg@cowlark.com    | Earthlike planets other than our own *do* look like
| (dg@tao-group.com) | Welsh quarries?" --- Coyu, on rasfw, while
+- www.cowlark.com --+ discussing _Blakes 7_