/[svn]/doc/docbase/instrument_scripts/nksp/reference/functions/nksp_exit_function.html
ViewVC logotype

Contents of /doc/docbase/instrument_scripts/nksp/reference/functions/nksp_exit_function.html

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3785 - (show annotations) (download) (as text)
Sun Jun 7 15:23:47 2020 UTC (4 months, 2 weeks ago) by schoenebeck
File MIME type: text/html
File size: 2255 byte(s)
* NKSP: clarify calling exit() from user function.

1 <html>
2 <head>
3 <meta name="author" content="Christian Schoenebeck">
4 <title>exit() function</title>
5 <meta name="description" content="Returns from current execution block.">
6 </head>
7 <body>
8 <h1>exit()</h1>
9 <p>
10 Returns from current execution block.
11 </p>
12 <p>
13 If the <code>exit()</code> function was called from a
14 <a href="nksp.html#user_functions">user function</a>,
15 that user function is exited and execution continues from where that
16 user function was called (e.g. from another user function or an event
17 handler).
18 </p>
19 <p>
20 If the <code>exit()</code> function was called <b>directly</b> from an
21 event handler, that event handler is exited (i.e. execution of that
22 event handler instance is stopped).
23 </p>
24 <note>
25 The function name <code>exit()</code> is a bit misleading. This function
26 behaves identical to return statements in other programming languages.
27 So calling <code>exit()</code> does <b>not</b> stop execution of other
28 instances of the same event handler, nor does it stop execution of other
29 handlers of other event types, and especially it does <b>not</b> stop or
30 prevent further or future execution of your entire script!
31 </note>
32
33 <h3>Function Prototype</h3>
34 <p/>
35 <code lang="nksp">
36 exit()
37 </code>
38
39 <h3>Arguments</h3>
40 <p>None.</p>
41
42 <h3>Return Value</h3>
43 <p>None.</p>
44
45 <h3>Examples</h3>
46 <p>
47 The following example prints a different message to the sampler's
48 terminal, depending on how many notes were triggered so far.
49 </p>
50 <code>
51 on init
52 declare $numberOfNotes
53 end on
54
55 on note
56 $numberOfNotes := $numberOfNotes + 1
57
58 select $numberOfNotes
59 case 1
60 message("First note was triggered!")
61 exit
62 case 2
63 message("Second note was triggered!")
64 exit
65 case 3
66 message("Third note was triggered!")
67 exit
68 end select
69
70 message("The " & $numberOfNotes & "th note triggered.")
71 end on
72 </code>
73
74 <h3>See also</h3>
75 <p><code>abort()</code>, <code>wait()</code>, <code>fork()</code>, <code>callback_status()</code><p>
76
77 <h3>Availability</h3>
78 <p>Since LinuxSampler 2.0.0<p>
79
80 </body>
81 </html>

  ViewVC Help
Powered by ViewVC