lua:cancelfunction
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| lua:cancelfunction [2014/12/27 07:11] – created vodur | lua:cancelfunction [2017/02/20 07:20] (current) – vodur | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== cancel ====== | ====== cancel ====== | ||
| - | Syntax 1: cancel() \\ | + | Syntax 1: cancel()\\ |
| Cancels any delayed functions linked to the game object invoking the cancel that have no tag set. | Cancels any delayed functions linked to the game object invoking the cancel that have no tag set. | ||
| - | Syntax 2: cancel(" | + | Syntax 2: cancel(" |
| Cancels any and all delayed functions linked to the game object invoking the cancel. | Cancels any and all delayed functions linked to the game object invoking the cancel. | ||
| - | Syntax 3: cancel(tag[string]) \\ | + | Syntax 3: cancel( tag<string> )\\ |
| Cancels any delayed functions linked to the game object invoking the cancel whose tag matches the tag argument. | Cancels any delayed functions linked to the game object invoking the cancel whose tag matches the tag argument. | ||
| Example1: | Example1: | ||
| - | functiondo_stuff()\\ | + | <code lua> |
| - | goto(31404)\\ | + | function do_stuff() |
| - | mdo(" | + | goto(31404) |
| - | goto(10204)\\ | + | mdo(" |
| - | end\\ | + | goto(10204) |
| - | \\ | + | end |
| - | delay(10, | + | |
| + | delay(10, do_stuff) | ||
| cancel() -- do_stuff will never run | cancel() -- do_stuff will never run | ||
| + | </ | ||
| Example2: | Example2: | ||
| - | functiondo_stuff()\\ | + | <code lua> |
| - | goto(31404)\\ | + | function do_stuff() |
| - | mdo(" | + | goto(31404) |
| - | goto(10204)\\ | + | mdo(" |
| - | end\\ | + | goto(10204) |
| - | \\ | + | end |
| - | delay(10, | + | |
| - | cancel(" | + | delay(10, do_stuff, " |
| + | cancel(" | ||
| + | </ | ||
| Example3: | Example3: | ||
| - | functiondo_stuff()\\ | + | <code lua> |
| - | goto(31404)\\ | + | function do_stuff() |
| - | mdo(" | + | goto(31404) |
| - | goto(10204)\\ | + | mdo(" |
| - | end\\ | + | goto(10204) |
| - | \\ | + | end |
| - | delay(10, | + | |
| + | delay(10, do_stuff, " | ||
| cancel(" | cancel(" | ||
| + | </ | ||
| See [[: | See [[: | ||
| + | |||
lua/cancelfunction.1419664269.txt.gz · Last modified: 2014/12/27 07:11 by vodur