Built-in Functions
The scripting API provides some built-in functions that can be used in your scripts.
| Function | Returns | Description |
| isUndefined(x) | bool | Query if a value is undefined. |
| isNumber(x) | bool | Query if a value is a number. Can be NaN or +/- Infinity or an ordinary number. |
| isNaN(x) | bool | Query if a value is the NaN (not a number) numeric value. |
| isInteger(x) | bool | Query if a value is an integer. |
| isClose(x, y, tolerance) | bool | Query if two numeric values are witihin a specified tolerance of each other. i.e. Math.abs(x-y) < tolerance |
| fromCelsiusToKelvin(t) | number | Convert a number from degrees Celsius to Kelvin. |
| fromKelvinToCelsius(t) | number | Convert a number from Kelvin to degrees Celsius. |
| fromFahrenheitToKelvin(t) | number | Convert a number from degrees Fahrenheit to Kelvin. |
| fromKelvinToFahrenheit(t) | number | Convert a number from Kelvin to degrees Fahrenheit. |
| message(msg[,params]) | undefined |
Outputs an informational message when running the script. Execution of the script continues after calling this function. Messages prefixed with "@" are not displayed by the Tablet client. Messages prefixed with "$" will always be shown by the Tablet client. "msg" must be a string. "params" is a n optional list of parameters to be substituted using MDF text style placeholders like %s (string), %f (number), %b (bool). |
| error(msg[,params]) | undefined |
Raises an error, aborting further execution of the script. This will cancel calculating of the charge plan for the current hole. "msg" must be a string. "params" is an optional list of parameters to be substituted using MDF text style placeholders like %s (string), %f (number), %b (bool). |
| assert(condition[,msg]) | undefined |
Check that condition evaluates to true. Raises an AssertionError exception if condition is false. "msg" is optional but if provided must be a string. |