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

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

Parent Directory Parent Directory | Revision Log Revision Log


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

1 schoenebeck 2732 <html>
2     <head>
3     <meta name="author" content="Christian Schoenebeck">
4     <title>exit() function</title>
5 schoenebeck 3785 <meta name="description" content="Returns from current execution block.">
6 schoenebeck 2732 </head>
7     <body>
8     <h1>exit()</h1>
9     <p>
10 schoenebeck 3785 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 schoenebeck 2732 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 schoenebeck 3785 prevent further or future execution of your entire script!
31     </note>
32    
33 schoenebeck 2732 <h3>Function Prototype</h3>
34     <p/>
35 schoenebeck 2742 <code lang="nksp">
36 schoenebeck 2732 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 schoenebeck 3237 <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 schoenebeck 2732 <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 schoenebeck 3237 message("First note was triggered!")
61 schoenebeck 2732 exit
62     case 2
63 schoenebeck 3237 message("Second note was triggered!")
64 schoenebeck 2732 exit
65     case 3
66 schoenebeck 3237 message("Third note was triggered!")
67 schoenebeck 2732 exit
68 schoenebeck 3237 end select
69 schoenebeck 2732
70     message("The " & $numberOfNotes & "th note triggered.")
71     end on
72     </code>
73    
74 schoenebeck 3278 <h3>See also</h3>
75 schoenebeck 3297 <p><code>abort()</code>, <code>wait()</code>, <code>fork()</code>, <code>callback_status()</code><p>
76 schoenebeck 3278
77     <h3>Availability</h3>
78     <p>Since LinuxSampler 2.0.0<p>
79    
80 schoenebeck 2732 </body>
81     </html>

  ViewVC Help
Powered by ViewVC