params | |||||||
Type | function | ||||||
Dictionary | LCS | ||||||
Library | LiveCode Script | ||||||
Syntax |
| ||||||
Summary | Returns all the parameters passed to the current handler. | ||||||
Introduced | 1.0 | ||||||
Changes | The format of the params when used in a function handler was changed in version 2.0. In previous versions, the format for functions was the same as the format for message handlers: the parameters were not enclosed in parentheses, but instead separated from the handler name by a space. | ||||||
OS | mac, windows, linux, ios, android | ||||||
Platforms | desktop, server, mobile | ||||||
Example |
| ||||||
Values |
| ||||||
Related | Command: call Function: paramCount Control Structure: function Glossary: pass, handler, parameter, function handler, return, value | ||||||
Description | Use the params function within a handler to get the parameters that were passed to the handler. Usually, you assign names to parameters in the first line of a function handler or message handler. For example, the following handler assigns three parameters:
If you call the above handler with four parameters, the first three parameters are assigned to the names thisParam, thatParam, and theOtherParam, but the fourth parameter is not assigned a name:
You can obtain the fourth parameter for use in the handler with the params function :
In this case, item 4 of the params is "yellow". (To use the value itself, you need to remove the opening and closing quotes.) If the params function is used in a function handler, the parameters are enclosed in parentheses. For example, the following function handler has three parameters:
If you call "myFunction" with the following statement:
the value returned by the params function is
LiveCode evaluates the parameters before passing them. So if you call myHandler with the following statement:
the value returned by the params function is
| ||||||
Tags | properties |