Server Function Template: Difference between revisions
(Created page with "{{ServerSide}} == Description == This is an example description for a server-side function template. == Syntax == <syntaxhighlight lang="javascript"> mp.examples.func(arg1...") |
mNo edit summary |
||
| (10 intermediate revisions by one other user not shown) | |||
| Line 1: | Line 1: | ||
{{ServerSide}} | {{ServerSide}} | ||
This is an example description for a server-side function template. | This is an example description for a server-side function template. | ||
| Line 7: | Line 5: | ||
== Syntax == | == Syntax == | ||
< | <pre> | ||
mp.examples.func(arg1, arg2, arg3); | mp.examples.func(arg1, arg2, arg3); | ||
</ | </pre> | ||
=== Parameters === | === Parameters === | ||
| Line 18: | Line 16: | ||
=== Returned Values === | === Returned Values === | ||
* ''' | * <span style="color: #408DAE"><b>true</b></span>: if the example function has been executed successfully. | ||
* | * <span style="color: #408DAE"><b>false</b></span>: otherwise. | ||
== Multiple Syntaxes == | |||
<pre> | |||
// Syntax I | |||
mp.examples.func(arg1, arg2, arg3); | |||
</pre> | |||
<pre> | |||
// Syntax II | |||
mp.examples.func(arg1, arg2, arg3, arg4[]); | |||
</pre> | |||
=== Syntax I Parameters === | |||
* '''arg1''': Explanation of example argument, parameter should be in <span style="color: #408DAE"><b>string</b></span> type. | |||
* '''arg2''': Explanation of second example argument, parameter should be in <span style="color: #408DAE"><b>int</b></span> type. | |||
* '''arg3''': Explanation of third example argument, parameter should be in <span style="color: #408DAE"><b>double</b></span> type. | |||
=== Syntax II Parameters === | |||
* '''arg1''': Explanation of example argument, parameter should be in <span style="color: #408DAE"><b>string</b></span> type. | |||
* '''arg2''': Explanation of second example argument, parameter should be in <span style="color: #408DAE"><b>int</b></span> type. | |||
* '''arg3''': Explanation of third example argument, parameter should be in <span style="color: #408DAE"><b>double</b></span> type. | |||
* '''arg4''': Explanation of fourth example argument, parameter should be in <span style="color: #408DAE"><b>array</b></span> type. | |||
=== Returned Values === | |||
* <span style="color: #408DAE"><b>true</b></span>: if the example function has been executed successfully. | |||
* <span style="color: #408DAE"><b>false</b></span>: otherwise. | |||
== Examples == | == Examples == | ||
| Line 25: | Line 53: | ||
This is a basic explanation about what does the example below do. | This is a basic explanation about what does the example below do. | ||
< | {{ServersideCode| | ||
let | <pre> | ||
</ | let val = mp.examples.func("George", 1, 2.0); | ||
</pre> | |||
}} | |||
This is a basic explanation about what does the example below do using 2nd syntax. | |||
{{ServersideCode| | |||
<pre> | |||
let val = mp.examples.func("George", 1, 2.0, ['foo', 'bar']); | |||
</pre> | |||
}} | |||
== See Also == | == See Also == | ||
* [[Example::Stuff|Example Stuff]] | * [[Example::Stuff|Example Stuff]] | ||
Latest revision as of 14:06, 26 October 2018
Server-Side
This is an example description for a server-side function template.
Syntax
mp.examples.func(arg1, arg2, arg3);
Parameters
- arg1: Explanation of example argument, parameter should be in string type.
- arg2: Explanation of second example argument, parameter should be in int type.
- arg3: Explanation of third example argument, parameter should be in double type.
Returned Values
- true: if the example function has been executed successfully.
- false: otherwise.
Multiple Syntaxes
// Syntax I mp.examples.func(arg1, arg2, arg3);
// Syntax II mp.examples.func(arg1, arg2, arg3, arg4[]);
Syntax I Parameters
- arg1: Explanation of example argument, parameter should be in string type.
- arg2: Explanation of second example argument, parameter should be in int type.
- arg3: Explanation of third example argument, parameter should be in double type.
Syntax II Parameters
- arg1: Explanation of example argument, parameter should be in string type.
- arg2: Explanation of second example argument, parameter should be in int type.
- arg3: Explanation of third example argument, parameter should be in double type.
- arg4: Explanation of fourth example argument, parameter should be in array type.
Returned Values
- true: if the example function has been executed successfully.
- false: otherwise.
Examples
This is a basic explanation about what does the example below do.
Server-Side
let val = mp.examples.func("George", 1, 2.0);
This is a basic explanation about what does the example below do using 2nd syntax.
Server-Side
let val = mp.examples.func("George", 1, 2.0, ['foo', 'bar']);