Skip to content

16. Built‐in Modules

Tom Dodd edited this page Dec 16, 2023 · 2 revisions

Below is a list of all built-in DSSL modules. The expected arguments are written in italics.

$math:

  • (num) finite: Pushes a true boolean if the number is finite, and a false boolean otherwise.

  • (num) infinite: Pushes a true boolean if the number is infinite, and a false boolean otherwise.

  • (num) inv: Pushes the reciprocal value of the number.

  • (num) neg: Pushes the negative value of the number.

  • (num) abs: Pushes the absolute value of the number.

  • (num) sgn: Pushes the signum value of the number.

  • (float) floor: Pushes the floor value of the float.

  • (float) ceil: Pushes the ceiling value of the float.

  • (float) trunc: Pushes the integer part of the float.

  • (float) fract: Pushes the fractional part of the float.

  • (float) round: Pushes the value of the float rounded to the nearest integer.

  • (float place) places: Pushes the value of the float rounded to the given decimal place.

  • (float) sin: Pushes the sine of the float.

  • (float) cos: Pushes the cosine of the float.

  • (float) tan: Pushes the tangent of the float.

  • (float) asin: Pushes the arcsine of the float.

  • (float) acos: Pushes the arccosine of the float.

  • (float) atan: Pushes the arctangent of the float.

  • (float) sinc: Pushes the sinc value of the float.

  • (float1 float2) atan2: Pushes the two-argument arctangent of the floats.

  • (float1 float2) hypot: Pushes the square root of the sum of the squares of the floats.

  • (float) rads: Pushes the conversion of the float in degrees to radians.

  • (float) degs: Pushes the conversion of the float in radians to degrees.

  • (float) exp: Pushes the exponential of the float.

  • (float) ln: Pushes the natural logarithm of the float.

  • (float) log2: Pushes the base-two logarithm of the float.

  • (float) log10: Pushes the base-ten logarithm of the float.

  • (float1 float2) log: Pushes the logarithm of the first float to the base of the second float.

  • (float) expm1: Pushes the exponential of the float minus one.

  • (float) ln1p: Pushes the natural logarithm of one plus the float.

  • (float) sqrt: Pushes the square root of the float.

  • (float) cbrt: Pushes the cube root of the float.

  • (float1 float2) root: Pushes the root of the first float with the power of the second float.

  • (float) isqrt: Pushes the integer part of the square root of the float.

  • (float) icbrt: Pushes the integer part of the cube root of the float.

  • (float1 float2) iroot: Pushes the integer part of the root of the first float with the power of the second float.

  • (float) sinh: Pushes the hyperbolic sine of the float.

  • (float) cosh: Pushes the hyperbolic cosine of the float.

  • (float) tanh: Pushes the hyperbolic tangent of the float.

  • (float) asinh: Pushes the hyperbolic arcsine of the float.

  • (float) acosh: Pushes the hyperbolic arccosine of the float.

  • (float) atanh: Pushes the hyperbolic arctangent of the float.

  • (num1 num2) min: Pushes the smaller of the two numbers.

  • (num1 num2) max: Pushes the greater of the two numbers.

  • (num1 num2 num3) clamp: Pushes the value of the first number clamped between the second and third numbers.

  • (num) clamp8: Pushes the value of the first number clamped between -128 and 127.

  • (num) clamp16: Pushes the value of the first number clamped between -32768 and 32767.

  • (num) clamp32: Pushes the value of the first number clamped between -2147483648 and 2147483647.

  • (num) clamp64: Pushes the value of the first number clamped between -9223372036854775808 and 9223372036854775807.

$const:

All constants are defined here.

$env:

  • args: Pushes a list of the program arguments. The first element is the path of the root script.

  • rootPath: Pushes the path of the root script.

  • rootDir: Pushes the directory of the root script.

  • (path) fromRoot: Pushes the path of the argument appended to the directory of the root script.

$fs:

  • (path) readFile: Pushes the contents of the file at the path as a string.

  • (path elem) writeFile: Writes the element as a string to the file at the path.

  • (path) readLines: Pushes the lines of the file at the path as a list of strings.

  • (path iterable) writeLines: Writes each element of the iterable argument as a string, followed by a newline, to the file at the path.

Clone this wiki locally