interrupting a repeat loop
Robert Brenstein
rjb at robelko.com
Tue Dec 15 10:59:39 EST 2009
On 15.12.2009 at 16:01 Uhr +0100 Jacques Hausser apparently wrote:
>Hi Tim
>
>it depends of the kind of loop you are using. Several possibilities
>For example in a card script:
>
>local stoploop
>
>command runTheLoop
> repeat forever
> if stoploop = "S" then exit repeat
> -- do what you want
> wait 10 milliseconds with message
> end repeat
>end runTheLoop
>
>on keyDown thekey
> put thekey into stoploop
>end keydown
>
>The "wait x milliseconds with message" is the important trick here.
>
>Jacques
>
If it is not relevant which key is being pressed, then a tad simpler
variation is
command runTheLoop
repeat forever
if the shiftkey is down then exit repeat
-- do what you want
end repeat
end runTheLoop
It could also be altKey/optionKey or controlKey/commandKey instead of shiftkey.
Robert
More information about the use-livecode
mailing list