Pass parameters to a function
- Last UpdatedJul 23, 2024
- 1 minute read
Parameters to standard predefined functions are usually passed by value. This means that you can pass any valid expression as a parameter, as long as the expression evaluates to the data type that is required for the parameter. Such expressions can include literal values, tag references, and function calls, all linked together by suitable operators. For more information on expressions and operators, see Value assignments and operators.
When the script calls the function, the expression is evaluated and the resulting value passed to the function.
However, there are some functions that require a tag reference as a parameter. For example:
RecipeSelectRecipe(Filename, RecipeName, Number);
In this example, the RecipeName parameter must be a tag reference (that is, you must use a literal tagname for the RecipeName parameter). You cannot pass a string expression instead, even if that expression evaluates to a valid tagname.
Note: Some legacy predefined functions with only one parameter (for example, the Ack() function) do not follow the standard syntax of passing parameters in parentheses. Instead, the parameter is separated from the function name by a space. Check the syntax description in the function documentation if you are in doubt about a particular function.