Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
user_defined_functions [2020/05/10 03:08] admin removed |
— (current) | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ===== User Defined Function ===== | ||
- | |||
- | User Defined Functions can improve the re-usability of your mscripts. User defined functions are first declared in // | ||
- | |||
- | Below is an example of a user function: | ||
- | |||
- | {{http:// | ||
- | |||
- | ---- | ||
- | |||
- | ==== Declare User Defined Function ==== | ||
- | |||
- | You can create as many user defined functions as you want. Each user defined function is declared with //func// tag that has a //name// attribute . | ||
- | <func name=" | ||
- | <log msg=" | ||
- | <action code=" | ||
- | </ | ||
- | |||
- | User defined function can take 0 or any number of parameters. Parameters are specified as key=value pairs. Multiple parameters are passed in separately, e.g. | ||
- | |||
- | $callFunc(' | ||
- | |||
- | Within the //func// tag, you add any mscript tags and methods. You can access the parameters passed into the function with mscript method // | ||
- | |||
- | ---- | ||
- | ==== Return Value ==== | ||
- | Optionally you can return a value. You can do so with mscript method // | ||
- | |||
- | Below is an example of a user defined function that returns a full name: | ||
- | |||
- | <func name=' | ||
- | <action code=" | ||
- | </ | ||
- | |||
- | |||
- | ---- | ||
- | ==== Call User Defined Function ==== | ||
- | To call this user defined function, use mscript method // | ||
- | |||
- | <log msg=" | ||
- | |||
- | |||
- | ---- | ||
- | ==== Accessing Parameters==== | ||
- | Inside the user function, you can access the input parameters with $getFuncParam(' | ||
- | |||
- | |||
- | User function may call another user function with // | ||
- | |||