From 416ee8e5afdb2d3a043db3205b3cce6baaee50e3 Mon Sep 17 00:00:00 2001 From: Lexi Date: Fri, 15 Dec 2023 12:36:46 -0500 Subject: [PATCH] Overview of builtin libraries --- Writerside/hi.tree | 1 - Writerside/redirection-rules.xml | 4 + .../topics/Builtin-Library-Reference.md | 201 +++++++++++++++++- Writerside/topics/General-Syntax-Tutorials.md | 2 +- Writerside/topics/Syntax-Reference.md | 3 - 5 files changed, 205 insertions(+), 6 deletions(-) delete mode 100644 Writerside/topics/Syntax-Reference.md diff --git a/Writerside/hi.tree b/Writerside/hi.tree index 06ec1d0..53628bb 100644 --- a/Writerside/hi.tree +++ b/Writerside/hi.tree @@ -26,7 +26,6 @@ - diff --git a/Writerside/redirection-rules.xml b/Writerside/redirection-rules.xml index 12e5773..f10797b 100644 --- a/Writerside/redirection-rules.xml +++ b/Writerside/redirection-rules.xml @@ -32,4 +32,8 @@ Making-Your-Part-Patches-More-Moddable-Using-Configs.html + + Created after removal of "Syntax Reference" from Patch Manager + Syntax-Reference.html + \ No newline at end of file diff --git a/Writerside/topics/Builtin-Library-Reference.md b/Writerside/topics/Builtin-Library-Reference.md index fe5d671..131edbe 100644 --- a/Writerside/topics/Builtin-Library-Reference.md +++ b/Writerside/topics/Builtin-Library-Reference.md @@ -1,3 +1,202 @@ # Builtin Library Reference -Start typing here... \ No newline at end of file +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`](builtin-debug.md) + +- `debug-log($value) -> none` + - Logs values to the unity console log +- `serialize($value) -> string` + - Used for converting any value to a string that uniquely +represents the value. + +## builtin:dictionary +Main page: [`builtin:dictionary`](builtin-dictionary.md) + +- `dictionary.set($dict,$key,$value) -> dictionary` + - Used for updating a key in a dictionary +- `dictionary.merge($original-dict,$new-dict) -> dictionary` + - Used to merge 2 dictionaries together into one +- `dictionary.keys($dict) -> list` + - Gets a list of keys from a dictionary +- `dictionary.values($dict) -> list` + - Gets a list of values from a dictionary +- `dictionary.remove($dict,$key) -> dictionary` + - Removes a value from a dictionary +- `dictionary.count($dict) -> integer` + - Gets the number of items in a dictionary + +## builtin:functional +Main page: [`builtin:functional`](builtin-functional.md) + +- `get-function($name) -> closure` + - Used to convert a function into a closure +- `closure.invoke($closure, ...) -> any` + - Used to invoke a closure +- `closure.bind($closure, ...) -> closure` + - Used to bind arguments to the left hand side of a closure +- `closure.right-bind($closure, ...) -> closure` + - Used to bind arguments to the right hand side of a closure + +## builtin:list +Main page: [`builtin:list`](builtin-list.md) +- `list.append($list,$value) -> list` + - Used to append a value onto the end of a list +- `list.append-all($list, $values) -> list` + - Used to append a list of values onto the end of a list +- `list.create(...) -> list` + - Used to create a list from the arguments +- `list.sort($list, [$comparator]) -> list` + - Used to sort a list, with an optional comparison function +- `list.map($list,$closure) -> list` + - Used to map a closure onto a list +- `list.filter($list,$closure) -> list` + - Used to filter a list depending on the results of a closure +- `list.reduce($list,$initial-value,$closure) -> any` + - Used to reduce a list using a closure +- `list.length($list) -> integer` + - Used to get the length of a list +- `list.join($list,$separator:"") -> string` + - Join a list into a string with an optional separator +## builtin:math +Main page: [`builtin:math`](builtin-math.md) +- `square-root($value) -> real` + - Take the square root of a number +- `cube-root($value) -> real` + - Take the cube root of a number +- `pow($x,$y) -> real` + - Calculate $x ^ $y +- `ln($a) -> real` + - Calculate the natural log of a number +- `log($a,$base) -> real` + - Calculate the logarithm of a number at a base +- `log10($a) -> real` + - Calculate the base 10 logarithm of a number +- `ceiling($a) -> real` + - Calculate the ceiling of a number +- `floor($a) -> real` + - Calculate the floor of a number +- `abs($a) -> real` + - Calculate the absolute value of a number +- `max(...) -> real` + - Return the maximum value of the arguments +- `min(...) -> real` + - Return the minimum value of the arguments +- `list.max($list) -> real` + - Return the maximum value of a list +- `list.min($list) -> real` + - Return the minimum value of a list +- `round($x) -> real` + - Rounds a value +- `sign($x) -> real` + - Returns the sign of a value +- `$E -> real` + - Euler's number +- `sin($a) -> real` + - Calculate the sine of an angle +- `cos($a) -> real` + - Calculate the cosine of an angle +- `tan($a) -> real` + - Calculate the tangent of an angle +- `sinh($a) -> real` + - Calculate the hyperbolic sine of an angle +- `cosh($a) -> real` + - Calculate the hyperbolic cosine of an angle +- `tanh($a) -> real` + - Calculate the hyperbolic tangent of an angle +- `asin($a) -> real` + - Calculate the inverse sine of a number +- `acos($a) -> real` + - Calculate the inverse cosine of a number +- `atan($a) -> real` + - Calculate the inverse tangent of a number +- `atan2($y,$x) -> real` + - Calculate the atan2 of $y and $x +- `$PI -> real` + - Pi +- `$TAU -> real` + - 2 * Pi +- `interpolate($a,$b,$t) -> real` + - Linear interpolation +- `list.normalize($vector) -> list` + - Normalize a list treating it as a vector +- `normalize(...) -> list` + - Normalize the arguments treating them as a vector +## builtin:meta +Main page: [`builtin:meta`](builtin-meta.md) +- `exists-mod($mod-name) -> boolean` + - Check if a mod is loaded in the current ksp2 instance +- `exists-function($function-name) -> boolean` + - Check if a function is defined +## builtin:reflection +Main page: [`builtin:reflection`](builtin-reflection.md) +- `typeof($value) -> string` + - Gets a values type as a string + +## builtin:string +Main page: [`builtin:string`](builtin-string.md) +- `string.length($string) -> integer` + - Gets the length of a string +- `string.reverse($string) -> string` + - Reverse a string +- `string.starts-with($string,$other-string) -> boolean` + - Check if a string starts with another string +- `string.ends-with($string,$other-string) -> boolean` + - Check if a string ends with another string +- `string.contains($string,$other-string) -> boolean` + - Check if a string contains another string +- `string.to-codepoint($string) -> int` + - Convert a one character string to a unicode codepoint +- `codepoint-to-string($codepoint) -> string` + - Convert a unicode codepoint to a single character string + +## builtin:type-conversion +Main page: [`builtin:type-conversion`](builtin-type-conversion.md) +- `to-bool($value) -> boolean` + - Convert a value to a boolean +- `to-real($value) -> real` + - Convert a value to a real +- `to-integer($value) -> integer` + - Convert a value to an integer +- `to-string($value) -> string` + - Convert a value to a string +- `dictionary.to-list($dict) -> list` + - Convert a dictionary to a list +- `list.to-dictionary($list) -> dictionary` + - Convert a list to a dictionary +- `string.to-list($string) -> list` + - Convert a string to a list of single characters +## builtin:config +Main page: [`builtin:config`](builtin-config.md) +- `get-config($label,$name) -> any` + - Get a specific config +- `get-configs($label) -> dictionary` + - Get all configs under a label +## builtin:parts +Main page: [`builtin:parts`](builtin-parts.md) +- `find-module($part-object,$module-name) -> dictionary/none` + - Find a module on a part object +- `add-module($part-object,$module) -> dictionary` + - Add a module to a part object +- `remove-module($part-object,$module-name) -> dictionary` + - Remove a module from a part object +- `replace-module($part-object, $module-name, $module) -> dictionary` + - Replace the module in a part object +- `create-module($type) -> dictionary` + - Create 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/none` + - Find a module data in a module object +- `add-module-data($part-module,$module-data) -> dictionary` + - Add module data to a module object +- `remove-module-data($part-module,$module-data-name) -> dictionary` + - Remove module data from a module object +- `replace-module-data($part-module,$module-data-name,$module-data) -> dictionary` + - Replace 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) -> dictionary` + - Get the data object from a module data object +- `set-data-object($module-data,$data-object) -> dictionary` + - Set the data object in a module data object \ No newline at end of file diff --git a/Writerside/topics/General-Syntax-Tutorials.md b/Writerside/topics/General-Syntax-Tutorials.md index c7acc2a..3a46b85 100644 --- a/Writerside/topics/General-Syntax-Tutorials.md +++ b/Writerside/topics/General-Syntax-Tutorials.md @@ -1,4 +1,4 @@ -# General Syntax Tutorials +# Syntax Reference You may want to get straight into patch manager patching, which is fine, in that case you can skip ahead to the [Part Patching Tutorials](Part-Patching-Tutorials.md), but it is highly recommended that you understand at least the diff --git a/Writerside/topics/Syntax-Reference.md b/Writerside/topics/Syntax-Reference.md deleted file mode 100644 index bb9ed07..0000000 --- a/Writerside/topics/Syntax-Reference.md +++ /dev/null @@ -1,3 +0,0 @@ -# Syntax Reference - -Start typing here... \ No newline at end of file