Built-in Functions

Source file: built-in-functions.htm

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, +/- 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 within a specified tolerance of each other, that is 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.

Note:  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), and %b (bool).

Note:  Messages prefixed with @ are not displayed by the BlastLogic Help Tablet client. Messages prefixed with $ will always be shown by the BlastLogic Help Tablet client.

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.

Note:  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), and %b (bool).

assert(condition[,msg]) undefined Check that condition evaluates to true. Raises an AssertionError exception if condition is false.

Note:  msg is optional but must be a string if provided.