lua-users home
lua-l archive

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


That’s a very interesting idea, but I’d really like to run some cleanup code in the same coroutine when the slideshow is aborted.

 

-----Original Message-----
From: lua-bounces@bazar2.conectiva.com.br [mailto:lua-bounces@bazar2.conectiva.com.br] On Behalf Of RLake@oxfam.org.pe
Sent:
Tuesday, April 13, 2004 11:14 AM
To: Lua list
Subject: Re: Simple Slideshow - user skip

 


> - Can I "inject" a return into the script via C? (dostring or something
> similar)
> - Or, do I have to abort my wait and then check a value like this:

>   Wait(seconds)
>   if (GetAbortFlag() == 1) then
>     do return end
>   ShowFrame()
>   ...

> That's a lot of code for the slideshow authors to have to include for each
> frame of the show and seems a little messy.  (BTW: the slideshow is in a
> coroutine that yields upon calling Wait() so the game can continue looping.)

Can't you just never resume the coroutine? There is no law saying that you have
to resume it -- just delete all references to it, and it will get garbage collected.