Shared Function Template: Difference between revisions
No edit summary |
No edit summary |
||
| Line 21: | Line 21: | ||
== Multiple Syntaxes == | == Multiple Syntaxes == | ||
{{ClientSide}} | |||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript"> | ||
// Syntax I | // Syntax I | ||
| Line 26: | Line 27: | ||
</syntaxhighlight> | </syntaxhighlight> | ||
{{ServerSide}} | |||
<syntaxhighlight lang="javascript"> | <syntaxhighlight lang="javascript"> | ||
// Syntax II | // Syntax II | ||
Revision as of 23:40, 4 February 2018
Shared
This is an example description for a shared 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
Client-Side
// Syntax I
mp.examples.func(arg1, arg2, arg3);
Server-Side
// 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.
//Syntax I
let val = mp.examples.func("Washington", 1, 2.0);
This is a basic explanation about what does the example below does using 2nd syntax.
//Syntax II
let val = mp.examples.func("Washington", 1, 2.0, ['foo', 'bar']);