Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 7149cda

Browse files
committed
Merge branch 'develop' of github.com:runrev/livecode into modular.
Conflicts: engine/Makefile.kernel engine/src/dskw32main.cpp engine/src/exec-filters.cpp libfoundation/include/foundation.h libfoundation/src/foundation-string.cpp
2 parents 6f6b416 + b7fb00e commit 7149cda

File tree

133 files changed

+1206
-962
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

133 files changed

+1206
-962
lines changed

builder/release_notes_builder.rev

261 Bytes
Binary file not shown.

docs/dictionary/control_st/function.xml

Lines changed: 1 addition & 96 deletions
Original file line numberDiff line numberDiff line change
@@ -1,96 +1 @@
1-
<doc>
2-
<legacy_id>1364</legacy_id>
3-
<name>function</name>
4-
<type>control structure</type>
5-
<syntax>
6-
<example>function <i>functionName </i>[<i>parametersList</i>] <i>statementList</i> end <i>functionName</i></example>
7-
</syntax>
8-
<library></library>
9-
<objects>
10-
</objects>
11-
<synonyms>
12-
</synonyms>
13-
<classification>
14-
<category>Writing LiveCode</category>
15-
</classification>
16-
<references>
17-
<keyword tag="private">private Keyword</keyword>
18-
<keyword tag="$">$ Keyword</keyword>
19-
<keyword tag="end">end Keyword</keyword>
20-
<function tag="param">param Function</function>
21-
<function tag="paramCount">paramCount Function</function>
22-
<function tag="functionNames">functionNames Function</function>
23-
<control_st tag="exit">exit Control Structure</control_st>
24-
</references>
25-
<history>
26-
<introduced version="1.0">Added.</introduced>
27-
</history>
28-
<platforms>
29-
<mac/>
30-
<windows/>
31-
<linux/>
32-
<ios/>
33-
<android/>
34-
</platforms>
35-
<classes>
36-
<desktop/>
37-
<server/>
38-
<web/>
39-
<mobile/>
40-
</classes>
41-
<security>
42-
</security>
43-
<summary>Defines a <href tag="">custom function</href> <glossary tag="handler">handler</glossary>.</summary>
44-
<examples>
45-
<example>function myFunctioneturn "test"</p><p>end myFunction</example>
46-
</examples>
47-
<description>
48-
<p>Use the <b>function</b> <glossary tag="control structure">control structure</glossary> to implement a <href tag="">custom function</href>.</p>
49-
<p>&nbsp;</p>
50-
<p><b>Form:</b></p>
51-
<p>The first line of a <b>function</b> <glossary tag="handler">handler</glossary> consists of the word "function" followed by the function's name. If the <href tag="">function</href> has any <glossary tag="parameter">parameters</glossary>, their names come after the <href tag="">function</href> name, separated by commas.</p>
52-
<p>&nbsp;</p>
53-
<p>The last line of a <b>function</b> <glossary tag="handler">handler</glossary> consists of the word "end" followed by the function's name.</p>
54-
<p>&nbsp;</p>
55-
<p><b>Parameters:</b></p>
56-
<p>The <i>functionName</i> is a <keyword tag="string">string</keyword> up to 65,535 <keyword tag="characters">characters</keyword> in length.</p>
57-
<p>&nbsp;</p>
58-
<p>The <i>parametersList</i> consists of one or more <glossary tag="parameter">parameter</glossary> names, separated by commas.</p>
59-
<p>&nbsp;</p>
60-
<p>The <i>statementList</i> consists of one or more <glossary tag="LiveCode">LiveCode</glossary> <glossary tag="statement">statements</glossary>.</p>
61-
<p>&nbsp;</p>
62-
<p><b>Comments:</b></p>
63-
<p>The purpose of a function is to compute a value and return it to the handler that called the function. The function's value is returned by a <b>return</b> <glossary tag="control structure">control structure</glossary> within the <b>function</b> <glossary tag="handler">handler</glossary>.</p>
64-
<p>&nbsp;</p>
65-
<p>A function handler can contain any set of LiveCode statements. Most functions contain a <b>return</b> <glossary tag="statement">statement</glossary>, which <glossary tag="return">returns</glossary> the value to the <glossary tag="caller">calling handler</glossary>. This example of a <href tag="">custom function</href> uses two <glossary tag="parameter">parameters</glossary> and <glossary tag="return">returns</glossary> a <keyword tag="string">string</keyword>:</p>
66-
<p>&nbsp;</p>
67-
<p>function reversedName firstName,lastName</p>
68-
<p><i>-- firstName and lastName are parameters</i></p>
69-
<p>put lastName,firstName into constructedName</p>
70-
<p>return constructedName</p>
71-
<p>end reversedName</p>
72-
<p>&nbsp;</p>
73-
<p>You create a custom function by writing a function handler for it. When you use the function in a script, the function call is passed through the message path. When it reaches the object whose script contains the <b>function</b> <glossary tag="handler">handler</glossary>, the <glossary tag="statement">statements</glossary> in the <glossary tag="handler">handler</glossary> are <glossary tag="execute">executed</glossary>.</p>
74-
<p>&nbsp;</p>
75-
<p>A custom function is called by name, just like a built-in function, as part of an expression. For example, this handler calls the custom function above:</p>
76-
<p>&nbsp;</p>
77-
<p>on mouseUp</p>
78-
<p>ask "What is your first name?"</p>
79-
<p>put it into firstParam</p>
80-
<p>ask "What is your last name?"</p>
81-
<p>put it into secondParam</p>
82-
<p>put reversedName(firstParam,secondParam) into field "Name"</p>
83-
<p>end mouseUp</p>
84-
<p>&nbsp;</p>
85-
<p>A function can call itself. The following example calls itself to compute the factorial of an integer:</p>
86-
<p>&nbsp;</p>
87-
<p>function factorial theNumber</p>
88-
<p>if theNumber &lt;= 1 then return 1</p>
89-
<p>else return theNumber * factorial(theNumber -1)</p>
90-
<p>end factorial</p>
91-
<p>&nbsp;</p>
92-
<p><b>Note:</b> To declare a function that is local to the script it is contained in, prefix the declaration with <keyword tag="private">private</keyword>. For more information about this see the dictionary entry for the <keyword tag="private">private keyword</keyword>.</p>
93-
<p>&nbsp;</p>
94-
<p><b>Changes: </b>The ability to declare private functions using the private keyword was added in LiveCode 2.8.1</p>
95-
</description>
96-
</doc>
1+
<doc> <legacy_id>1364</legacy_id> <name>function</name> <type>control structure</type> <syntax> <example>function <i>functionName </i>[<i>parametersList</i>] <i>statementList</i> end <i>functionName</i></example> </syntax> <synonyms> </synonyms> <summary>Defines a custom function <glossary tag="handler">handler</glossary>.</summary> <examples><example><p>function myFunctioneturn "test"</p><p>end myFunction</p></example> </examples> <history> <introduced version="1.0">Added.</introduced> <deprecated version=""></deprecated> <removed version=""></removed> <experimental version=""></experimental> <nonexperimental version=""></nonexperimental> </history> <objects> </objects> <platforms> <mac/> <windows/> <linux/> <ios/> <android/> </platforms> <classes> <desktop/> <server/> <web/> <mobile/> </classes> <security> </security> <classification> <category>Writing LiveCode</category> </classification> <references> <function tag="param">param Function</function> <function tag="paramCount">paramCount Function</function> <function tag="functionNames">functionNames Function</function> <keyword tag="private">private Keyword</keyword> <keyword tag="$">$ Keyword</keyword> <keyword tag="end">end Keyword</keyword> <control_st tag="exit">exit Control Structure</control_st> </references> <description>Use the <b>function</b> <glossary tag="control structure">control structure</glossary> to implement a custom function.<p></p><p><b>Form:</b></p><p>The first line of a <b>function</b> <glossary tag="handler">handler</glossary> consists of the word "function" followed by the function's name. If the function has any <glossary tag="parameter">parameters</glossary>, their names come after the function name, separated by commas.</p><p></p><p>The last line of a <b>function</b> <glossary tag="handler">handler</glossary> consists of the word "end" followed by the function's name.</p><p></p><p><b>Parameters:</b></p><p>The <i>functionName</i> is a <keyword tag="string">string</keyword> up to 65,535 <keyword tag="characters">characters</keyword> in length.</p><p></p><p>The <i>parametersList</i> consists of one or more <glossary tag="parameter">parameter</glossary> names, separated by commas.</p><p></p><p>The <i>statementList</i> consists of one or more <glossary tag="LiveCode">LiveCode</glossary> <glossary tag="statement">statements</glossary>.</p><p></p><p><b>Comments:</b></p><p>The purpose of a function is to compute a value and return it to the handler that called the function. The function's value is returned by a <b>return</b> <glossary tag="control structure">control structure</glossary> within the <b>function</b> <glossary tag="handler">handler</glossary>.</p><p></p><p>A function handler can contain any set of LiveCode statements. Most functions contain a <b>return</b> <glossary tag="statement">statement</glossary>, which <glossary tag="return">returns</glossary> the value to the <glossary tag="caller">calling handler</glossary>. This example of a custom function uses two <glossary tag="parameter">parameters</glossary> and <glossary tag="return">returns</glossary> a <keyword tag="string">string</keyword>:</p><p></p><p>function reversedName firstName,lastName</p><p><i>-- firstName and lastName are parameters</i></p><p>put lastName,firstName into constructedName</p><p>return constructedName</p><p>end reversedName</p><p></p><p>You create a custom function by writing a function handler for it. When you use the function in a script, the function call is passed through the message path. When it reaches the object whose script contains the <b>function</b> <glossary tag="handler">handler</glossary>, the <glossary tag="statement">statements</glossary> in the <glossary tag="handler">handler</glossary> are <glossary tag="execute">executed</glossary>.</p><p></p><p>A custom function is called by name, just like a built-in function, as part of an expression. For example, this handler calls the custom function above:</p><p></p><p>on mouseUp</p><p>ask "What is your first name?"</p><p>put it into firstParam</p><p>ask "What is your last name?"</p><p>put it into secondParam</p><p>put reversedName(firstParam,secondParam) into field "Name"</p><p>end mouseUp</p><p></p><p>A function can call itself. The following example calls itself to compute the factorial of an integer:</p><p></p><p>function factorial theNumber</p><p>if theNumber = 1 then return 1</p><p>else return theNumber * factorial(theNumber -1)</p><p>end factorial</p><p></p><p></p><p></p><p></p><note>To declare a function that is local to the script it is contained in, prefix the declaration with <keyword tag="private">private</keyword>. For more information about this see the dictionary entry for the <keyword tag="private">private keyword</keyword>.</note><p></p><p></p><p></p><p></p><note>As the <function tag="result">result</function> is a global property, if you do not explicitly <control_st tag="return">return</control_st> a value, then <function tag="result">the result</function> will no change, but reflect the last engine command, engine function or command or function handler that did return a value.</note><p></p><p></p><p></p><p></p><change></change>The ability to declare private functions using the private keyword was added in LiveCode 2.8.1</description></doc>

0 commit comments

Comments
 (0)