MinitScript  0.9.31 PRE-BETA
README-BuiltIn-Functions

LOGO

1. Built In - Functions

1.1. Base functions

                                                                                          Table of functions                                                                                          
Returns if variable is a constant variable
isConstant($variable: Mixed): Boolean
Set constant
setConstant($constant: String, $value: Mixed): Mixed
Returns if variable is a reference variable
isReference($variable: Mixed): Boolean
Get variable type
getType($variable: Mixed): String
Returns if variable exists
hasVariable($variable: String): Boolean
Get variable
getVariable($variable: String): Mixed
Set variable
setVariable($variable: String, $value: Mixed[, $operator: Integer]): Mixed
Add
add($a: Mixed, $b: Mixed[, $operator: Integer]): Mixed
Logical and
and($a: Boolean, $b: Boolean[, $operator: Integer]): Boolean
Bitwise and
bitwiseAnd($a: Integer, $b: Integer[, $operator: Integer]): Integer
Bitwise not
bitwiseNot($value: Integer[, $operator: Integer]): Integer
Bitwise or
bitwiseOr($a: Integer, $b: Integer[, $operator: Integer]): Integer
Bitwise xor
bitwiseXor($a: Integer, $b: Integer[, $operator: Integer]): Integer
Create boolean
boolean($boolean: Boolean): Boolean
Break out of forCondition or forTime loop
break([$levels: Integer]): Null
Begins a case block within a switch block, which will be executed if the case value has matched
case($value: Mixed): Null
Continue to next iteration of forCondition or forTime loop
continue([$levels: Integer]): Null
Begins a default block within a switch block, which will be executed if no case value has matched
default(): Null
Divide
div($a: Mixed, $b: Mixed[, $operator: String]): Mixed
Else
else(): Null
Else if
elseif($condition: Boolean): Null
End
end(): Null
Equals
equals($a: Mixed, $b: Mixed[, $operator: Integer]): Boolean
For condition
forCondition($condition: Boolean[, $iterationStacklet: Stacklet]): Null
For time
forTime($time: Integer): Null
Greater
greater($a: Mixed, $b: Mixed[, $operator: Integer]): Boolean
Greater equals
greaterEquals($a: Mixed, $b: Mixed[, $operator: Integer]): Boolean
If
if($condition: Boolean): Null
Create integer
integer($integer: Integer): Integer
Lesser
lesser($a: Mixed, $b: Mixed[, $operator: Integer]): Boolean
Lesser equals
lesserEquals($a: Mixed, $b: Mixed[, $operator: Integer]): Boolean
Compute modulo
mod($value: Number, $range: Number[, $operator: String]): Number
Multiply
mul($a: Mixed, $b: Mixed[, $operator: String]): Mixed
Logical not
not($boolean: Boolean[, $operator: Integer]): Boolean
Logical not equal
notEqual($a: Mixed, $b: Mixed[, $operator: Integer]): Boolean
Logical or
or($a: Boolean, $b: Boolean[, $operator: Integer]): Boolean
Postfix decrement
postfixDecrement(&$variable: Integer[, $operator: Integer]): Integer
Postfix increment
postfixIncrement(&$variable: Integer[, $operator: Integer]): Integer
Prefix decrement
prefixDecrement(&$variable: Integer[, $operator: Integer]): Integer
Prefix increment
prefixIncrement(&$variable: Integer[, $operator: Integer]): Integer
Returns from function with optional return value
return([$value: Mixed]): Null
Subtract
sub($a: Mixed, $b: Mixed[, $operator: String]): Mixed
Swap two variables
swap(&$a: Mixed, &$b: Mixed): Null
Begins switch block to match a given value to case values or a default
switch($value: Mixed): Null

1.2. Application functions

                                                                                          Table of functions                                                                                          
Get application command line arguments
application.getArguments(): Array
Execute Application
application.execute($command: String[, &$exitCode: ?Integer[, &$error: ?String]]): String
Exit application with optional exit code
application.exit([$exitCode: Integer]): Null

1.3. Concurrency functions

                                                                                          Table of functions                                                                                          
Returns hardware thread count, which usually is the number of CPU cores(* 2, if hyperthreading is enabled)
concurrency.getHardwareThreadCount(): Integer

1.4. Console functions

                                                                                          Table of functions                                                                                          
Pretty print variable to console
console.dump($value: Mixed): Null
Print to console without trainling new line
console.print(...): Null
Print to console with a trailing new line
console.printLine(...): Null
Read all input into string value
console.readAll(): String
Read all input into array of strings
console.readAllAsArray(): Array
Read a line from input
console.readLine(): String

1.5. Error console/stream functions

                                                                                          Table of functions                                                                                          
Print to error console/stream without trainling new line
console.error.print(...): Null
Print to error console/stream with a trailing new line
console.error.printLine(...): Null

1.6. Script container and interoperability functions

                                                                                          Table of functions                                                                                          
Returns if a script has a specific callable function
context.script.hasCallable($scriptId: String, $callable: String): Boolean
Returns all script ids of its context
context.script.getScriptIds(): Array
Call a script callable function
context.script.call($scriptId: String, $callable: String, ...): Mixed
Load a script into context
context.script.loadScript($scriptId: String, $pathName: String, $fileName: String[, $verbose: Boolean]): Null
Remove a script from context
context.script.removeScript($scriptId: String): Null

1.1. Cryptography Base64 functions

                                                                                          Table of functions                                                                                          
Decode a Base64 encoded string
cryptography.base64.decode($value: String): String
Encode a string using Base64
cryptography.base64.encode($value: String): String

1.8. Cryptography SHA256 functions

                                                                                          Table of functions                                                                                          
Hash a string using SHA256
cryptography.sha256.encode($value: String): String

1.9. File System functions

                                                                                          Table of functions                                                                                          
Get canonical URI
filesystem.getCanonicalURI($pathName: String, $fileName: String): ?String
Get file content as byte array
filesystem.getContent($pathName: String, $fileName: String): ?ByteArray
Set file content from byte array
filesystem.setContent($pathName: String, $fileName: String, $content: ByteArray): Boolean
Get file content as string
filesystem.getContentAsString($pathName: String, $fileName: String): ?String
Get file content as string array
filesystem.getContentAsStringArray($pathName: String, $fileName: String): ?Array
Set file content from string
filesystem.setContentFromString($pathName: String, $fileName: String, $content: String): Boolean
Set file content from string array
filesystem.setContentFromStringArray($pathName: String, $fileName: String, $content: Array): Boolean
Get current working path name
filesystem.getCurrentWorkingPathName(): ?String
Returns if given URI is a drive name(applies to Microsoft Windows only)
filesystem.isDrive($uri: String): Boolean
Extracts file name from given URI
filesystem.getFileName($uri: String): String
Returns file size from file
filesystem.getFileSize($pathName: String, $fileName: String): ?Integer
Returns if given URI is a path
filesystem.isPath($uri: String): ?Boolean
Extracts path name from given URI
filesystem.getPathName($uri: String): String
Change current working path
filesystem.changePath($pathName: String): Boolean
Compose URI from given path name and file name
filesystem.composeURI($pathName: String, $fileName: String): String
Create path
filesystem.createPath($pathName: String): Boolean
Returns if URI does exist
filesystem.exists($uri: String): ?Boolean
List folder
filesystem.list($pathName: String): ?Array
Move file/folder from a location to another location
filesystem.move($uriFrom: String, $uriTo: String): Boolean
Removes a file with given file name
filesystem.removeFile($pathName: String, $fileName: String): Boolean
Removes a file extension from given file name
filesystem.removeFileExtension($fileName: String): String
Removes a path from file system
filesystem.removePath($pathName: String, $recursive: String): Boolean
Renames a file/folder
filesystem.rename($fileNameFrom: String, $fileNameTo: String): Boolean

1.10. Float functions

                                                                                          Table of functions                                                                                          
Create float
float($float: Float): Float
Convert integer bit representation of float to float
float.fromIntegerValue($integer: Integer): Float
Convert float to integer bit representation of float
float.toIntegerValue($float: Float): Integer

1.11. Hex functions

                                                                                          Table of functions                                                                                          
Decode hexadecimal string to integer value
hex.decode($value: String): Integer
Encode integer value to hexadecimal string
hex.encode($value: Integer): String

1.12. JSON functions

                                                                                          Table of functions                                                                                          
Deserialize JSON
json.deserialize($json: String): Mixed
Serialize JSON
json.serialize($value: Mixed): String

1.13. Math functions

                                                                                          Table of functions                                                                                          
Returns number as positive number
math.abs($value: Number): Number
Returns number to be positive within given range
math.absmod($value: Number, $range: Number): Number
Compute acos
math.acos($x: Float): Float
Compute asin
math.asin($x: Float): Float
Compute atan
math.atan($x: Float): Float
Compute atan2
math.atan2($y: Float, $x: Float): Float
Round float up to next higher integer
math.ceil($value: Float): Float
Returns number clamped to be in given range
math.clamp($value: Number, $min: Number, $max: Number): Number
Compute acos
math.cos($x: Float): Float
Compute exp
math.exp($power: Float): Float
Round float down to next lower integer
math.floor($value: Float): Float
Compute log
math.log($value: Float): Float
Returns maximum number of given values
math.max($value1: Number, $value2: Number): Number
Returns minimum number of given values
math.min($value1: Number, $value2: Number): Number
Compute modulo/remainder
math.mod($value: Number, $range: Number): Number
Compute pow
math.pow($base: Number, $power: Number): Number
Create a random number between 0.0 and 1.0
math.random(): Float
Round float up or down to integer
math.round($value: Float): Float
Returns sign of given number
math.sign($value: Number): Number
Compute sin
math.sin($x: Float): Float
Compute square root
math.sqrt($value: Float): Float
Compute square product
math.square($value: Number): Number
Compute tan
math.tan($x: Float): Float

1.14. HTTP/HTTPS client functions

                                                                                          Table of functions                                                                                          
Execute a HTTP/HTTPS GET request
network.httpclient.get($url: String[, $queryParameters: ?Map[, $headers: ?Map]]): ?Map
Execute a HTTP/HTTPS DELETE request
network.httpclient.delete($url: String[, $queryParameters: ?Map[, $headers: ?Map]]): ?Map
Execute a HTTP/HTTPS HEAD request
network.httpclient.head($url: String[, $queryParameters: ?Map[, $headers: ?Map]]): ?Map
Execute a HTTP/HTTPS POST request
network.httpclient.post($url: String, $data: Mixed[, $queryParameters: ?Map[, $headers: ?Map]]): ?Map
Execute a HTTP/HTTPS PUT request
network.httpclient.put($url: String, $data: Mixed[, $queryParameters: ?Map[, $headers: ?Map]]): ?Map

1.15. Script functions

                                                                                          Table of functions                                                                                          
Get named conditions
script.getNamedConditions(): String
Returns if script runs natively
script.isNative(): Boolean
Get script variables
script.getVariables(): Map
Call script function
script.call($function: String, ...): Mixed
Call function by function variable
script.callFunction($function: Function, ...): Mixed
Call script stacklet
script.callStacklet($stacklet: String): Mixed
Disable a specific named condition
script.disableNamedCondition($name: String): Null
Emit a condition
script.emit($condition: String): Null
Enable a specific named condition
script.enableNamedCondition($name: String): Null
Evaluate a script statement
script.evaluate($statement: String): Mixed
Stop script
script.stop(): Null
Wait for given milliseconds
script.wait($time: Integer): Null
Wait for condition to happen
script.waitForCondition(): Null

1.16. Script error functions

                                                                                          Table of functions                                                                                          
Get last error message if any occurred
script.error.getMessage(): ?String
Get last error statement if any exists
script.error.getStatement(): ?Map

1.11. Time functions

                                                                                          Table of functions                                                                                          
Get time as string
time.getAsString([$format: String]): String
Get current time in milliseconds
time.getCurrentMillis(): Integer

1.18. XML functions

                                                                                          Table of functions                                                                                          
Create XML tag
xml.createTag($name: String[, $attributes: Map[, $innerXML: String]]): String

2. Links

2.1. Language Documentation

2.2. Other Links