[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: RE: PATCH: true C coroutines -- yield across C stack from anywhere
- From: Daniel Silverstone <dsilvers@...>
- Date: Fri, 22 Oct 2004 14:10:21 +0100
On Fri, 2004-10-22 at 15:00 +0200, Jean-Christophe Capdevila wrote:
> I want:
> While true do
> Goto(WayPointA)
> Goto(WayPointB)
> Goto(WayPointC)
> Goto(WayPointD)
> PlayAndWaitAnim("dummyanim")
> end
> 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
function CurriedLoops(func)
local unpack = unpack
return function(...) return while func(unpack(arg)) do end end
end
Goto = CurriedLoops(Goto)
PlayAndWaitAnim = CurriedLoops(PlayAndWaitAnim)
And lo the second mechanism works but looks like the first form :-)
D.
--
Daniel Silverstone http://www.digital-scurf.org/
PGP mail accepted and encouraged. Key Id: 2BC8 4016 2068 7895