User Tools

Site Tools


lua:cancelfunction

This is an old revision of the document!


cancel

Syntax 1: cancel()
Cancels any delayed functions linked to the game object invoking the cancel that have no tag set.

Syntax 2: cancel(“*”)
Cancels any and all delayed functions linked to the game object invoking the cancel.

Syntax 3: cancel(tag[string])
Cancels any delayed functions linked to the game object invoking the cancel whose tag matches the tag argument.

Example1:

function do_stuff()
    goto(31404)
    mdo("dance")
    goto(10204)
end
 
delay(10, do_stuff)
cancel() -- do_stuff will never run

Example2:

function do_stuff()
    goto(31404)
    mdo("dance")
    goto(10204)
end
 
delay(10, do_stuff, "stuff") -- Give the delay a "stuff" tag so we can target it with cancel
cancel("*") -- cancel all delays no matter what

Example3:

function do_stuff()
    goto(31404)
    mdo("dance")
    goto(10204)
end
 
delay(10, do_stuff, "stuff") -- Give the delay a "stuff" tag so we can target it with cancel
cancel("stuff") -- do_stuff will never run

See delay

lua/cancelfunction.1487287481.txt.gz · Last modified: 2017/02/16 15:24 by vodur