Builtin Library Reference
This section shall list all the builtin libraries that patch manager has, link to the pages of their documentation and then list the methods and variables in them with a short description.
builtin:debug
Main page: builtin:debug
debug-log($value) -> noneLogs values to the unity console log
serialize($value) -> stringUsed for converting any value to a string that uniquely represents the value.
builtin:dictionary
Main page: builtin:dictionary
dictionary.set($dict,$key,$value) -> dictionaryUsed for updating a key in a dictionary
dictionary.merge($original-dict,$new-dict) -> dictionaryUsed to merge 2 dictionaries together into one
dictionary.keys($dict) -> listGets a list of keys from a dictionary
dictionary.values($dict) -> listGets a list of values from a dictionary
dictionary.remove($dict,$key) -> dictionaryRemoves a value from a dictionary
dictionary.count($dict) -> integerGets the number of items in a dictionary
builtin:functional
Main page: builtin:functional
get-function($name) -> closureUsed to convert a function into a closure
closure.invoke($closure, ...) -> anyUsed to invoke a closure
closure.bind($closure, ...) -> closureUsed to bind arguments to the left hand side of a closure
closure.right-bind($closure, ...) -> closureUsed to bind arguments to the right hand side of a closure
builtin:list
Main page: builtin:list
list.append($list,$value) -> listUsed to append a value onto the end of a list
list.append-all($list, $values) -> listUsed to append a list of values onto the end of a list
list.create(...) -> listUsed to create a list from the arguments
list.sort($list, [$comparator]) -> listUsed to sort a list, with an optional comparison function
list.map($list,$closure) -> listUsed to map a closure onto a list
list.filter($list,$closure) -> listUsed to filter a list depending on the results of a closure
list.reduce($list,$initial-value,$closure) -> anyUsed to reduce a list using a closure
list.length($list) -> integerUsed to get the length of a list
list.join($list,$separator:"") -> stringJoin a list into a string with an optional separator
builtin:math
Main page: builtin:math
square-root($value) -> realTake the square root of a number
cube-root($value) -> realTake the cube root of a number
pow($x,$y) -> realCalculate $x ^ $y
ln($a) -> realCalculate the natural log of a number
log($a,$base) -> realCalculate the logarithm of a number at a base
log10($a) -> realCalculate the base 10 logarithm of a number
ceiling($a) -> realCalculate the ceiling of a number
floor($a) -> realCalculate the floor of a number
abs($a) -> realCalculate the absolute value of a number
max(...) -> realReturn the maximum value of the arguments
min(...) -> realReturn the minimum value of the arguments
list.max($list) -> realReturn the maximum value of a list
list.min($list) -> realReturn the minimum value of a list
round($x) -> realRounds a value
sign($x) -> realReturns the sign of a value
$E -> realEuler's number
sin($a) -> realCalculate the sine of an angle
cos($a) -> realCalculate the cosine of an angle
tan($a) -> realCalculate the tangent of an angle
sinh($a) -> realCalculate the hyperbolic sine of an angle
cosh($a) -> realCalculate the hyperbolic cosine of an angle
tanh($a) -> realCalculate the hyperbolic tangent of an angle
asin($a) -> realCalculate the inverse sine of a number
acos($a) -> realCalculate the inverse cosine of a number
atan($a) -> realCalculate the inverse tangent of a number
atan2($y,$x) -> realCalculate the atan2 of $y and $x
$PI -> realPi
$TAU -> real2 * Pi
interpolate($a,$b,$t) -> realLinear interpolation
list.normalize($vector) -> listNormalize a list treating it as a vector
normalize(...) -> listNormalize the arguments treating them as a vector
builtin:meta
Main page: builtin:meta
exists-mod($mod-name) -> booleanCheck if a mod is loaded in the current ksp2 instance
exists-function($function-name) -> booleanCheck if a function is defined
builtin:reflection
Main page: builtin:reflection
typeof($value) -> stringGets a values type as a string
builtin:string
Main page: builtin:string
string.length($string) -> integerGets the length of a string
string.reverse($string) -> stringReverse a string
string.starts-with($string,$other-string) -> booleanCheck if a string starts with another string
string.ends-with($string,$other-string) -> booleanCheck if a string ends with another string
string.contains($string,$other-string) -> booleanCheck if a string contains another string
string.to-codepoint($string) -> intConvert a one character string to a unicode codepoint
codepoint-to-string($codepoint) -> stringConvert a unicode codepoint to a single character string
builtin:type-conversion
Main page: builtin:type-conversion
to-bool($value) -> booleanConvert a value to a boolean
to-real($value) -> realConvert a value to a real
to-integer($value) -> integerConvert a value to an integer
to-string($value) -> stringConvert a value to a string
dictionary.to-list($dict) -> listConvert a dictionary to a list
list.to-dictionary($list) -> dictionaryConvert a list to a dictionary
string.to-list($string) -> listConvert a string to a list of single characters
builtin:config
Main page: builtin:config
get-config($label,$name) -> anyGet a specific config
get-configs($label) -> dictionaryGet all configs under a label
builtin:parts
Main page: builtin:parts
find-module($part-object,$module-name) -> dictionary/noneFind a module on a part object
add-module($part-object,$module) -> dictionaryAdd a module to a part object
remove-module($part-object,$module-name) -> dictionaryRemove a module from a part object
replace-module($part-object, $module-name, $module) -> dictionaryReplace the module in a part object
create-module($type) -> dictionaryCreate a module object based on a type name (the module type must be in a loaded assembly)
find-module-data($part-module,$module-data-name) -> dictionary/noneFind a module data in a module object
add-module-data($part-module,$module-data) -> dictionaryAdd module data to a module object
remove-module-data($part-module,$module-data-name) -> dictionaryRemove module data from a module object
replace-module-data($part-module,$module-data-name,$module-data) -> dictionaryReplace module data in a module object
create-module-data($type)Create a module data object based on a type name (the module data type must be in a loaded assembly)
get-data-object($module-data) -> dictionaryGet the data object from a module data object
set-data-object($module-data,$data-object) -> dictionarySet the data object in a module data object