Refactored Base instructions and added documentation
This commit is contained in:
parent
deccb1f6fa
commit
dc0811a271
10 changed files with 372 additions and 72 deletions
39
docs/instructions/base/array_get.md
Normal file
39
docs/instructions/base/array_get.md
Normal file
|
@ -0,0 +1,39 @@
|
|||
# array_get
|
||||
|
||||
Get an item from an array using "dot" notation.
|
||||
|
||||
## Parameters
|
||||
|
||||
* array (`array`, `instruction`) - The array to get the value from.
|
||||
* key (`string`, `instruction`) - The key to get the value for.
|
||||
|
||||
## Return
|
||||
|
||||
(mixed) - The value of the key or throws an exception if the key is not found.
|
||||
|
||||
## Exceptions
|
||||
|
||||
* `EvaluationException` - If there was an error while evaluating one or more parameters.
|
||||
* `KeyException` - If the key is not found.
|
||||
* `TypeException` - If one or more parameters are not of the expected type.
|
||||
|
||||
## Instruction Example
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "array_get",
|
||||
"_": {
|
||||
"array": {
|
||||
"foo": {
|
||||
"bar": "baz"
|
||||
}
|
||||
},
|
||||
"key": "foo.bar"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Last Updated
|
||||
|
||||
Monday, December 26th, 2022.
|
||||
Written by [Netkas](https://git.n64.cc/netkas)
|
41
docs/instructions/base/array_set.md
Normal file
41
docs/instructions/base/array_set.md
Normal file
|
@ -0,0 +1,41 @@
|
|||
# array_set
|
||||
|
||||
Set an item in an array using "dot" notation.
|
||||
|
||||
## Parameters
|
||||
|
||||
* array (`array`, `instruction`) - The array to get the value from.
|
||||
* key (`string`, `instruction`) - The key to get the value for.
|
||||
* value (`any`, `instruction`) - The value to set.
|
||||
|
||||
## Return
|
||||
|
||||
(`array`) - The array with the new value set.
|
||||
|
||||
## Exceptions
|
||||
|
||||
* `EvaluationException` - If there was an error while evaluating one or more parameters.
|
||||
* `KeyException` - If the key is not found.
|
||||
* `TypeException` - If one or more parameters are not of the expected type.
|
||||
|
||||
## Instruction Example
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "array_set",
|
||||
"_": {
|
||||
"array": {
|
||||
"foo": {
|
||||
"bar": "baz"
|
||||
}
|
||||
},
|
||||
"key": "foo.bar",
|
||||
"value": "qux"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Last Updated
|
||||
|
||||
Monday, December 26th, 2022.
|
||||
Written by [Netkas](https://git.n64.cc/netkas)
|
34
docs/instructions/base/get.md
Normal file
34
docs/instructions/base/get.md
Normal file
|
@ -0,0 +1,34 @@
|
|||
# get
|
||||
|
||||
Gets an existing variable from the environment.
|
||||
|
||||
## Parameters
|
||||
|
||||
* name (`string`, `instruction`) - The name of the variable to get.
|
||||
|
||||
## Return
|
||||
|
||||
(`any`) - The value of the variable.
|
||||
|
||||
## Exceptions
|
||||
|
||||
* `EvaluationException` - If there was an error while evaluating one or more parameters.
|
||||
* `TypeException` - If one or more parameters are not of the expected type.
|
||||
* `NameException` - If the variable does not exist.
|
||||
|
||||
|
||||
## Instruction Example
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "get",
|
||||
"_": {
|
||||
"name": "foo"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Last Updated
|
||||
|
||||
Monday, December 29th, 2022.
|
||||
Written by [Netkas](https://git.n64.cc/netkas)
|
42
docs/instructions/base/invoke.md
Normal file
42
docs/instructions/base/invoke.md
Normal file
|
@ -0,0 +1,42 @@
|
|||
# invoke
|
||||
|
||||
Invokes a method under a namespace.
|
||||
|
||||
## Parameters
|
||||
|
||||
* namespace (`string`, `instruction`) - The namespace to invoke the method under.
|
||||
* method (`string`, `instruction`) - The method to invoke.
|
||||
* parameters (`array`, `instruction`) - The parameters to pass to the method.
|
||||
* fail_on_error (`boolean`, `instruction`) - Whether to fail if the method throws an exception.
|
||||
|
||||
## Return
|
||||
|
||||
(`any`) - The return value of the method. See the method's documentation for more information.
|
||||
|
||||
## Exceptions
|
||||
|
||||
* `EvaluationException` - If there was an error while evaluating one or more parameters.
|
||||
* `TypeException` - If one or more parameters are not of the expected type.
|
||||
* `UndefinedMethodException` - If the method is not defined.
|
||||
* `Exception` - If the method throws an exception and `fail_on_error` is `true`.
|
||||
|
||||
## Instruction Example
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "invoke",
|
||||
"_": {
|
||||
"namespace": "system",
|
||||
"method": "print",
|
||||
"parameters": {
|
||||
"value": "Hello, world!"
|
||||
},
|
||||
"fail_on_error": true
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Last Updated
|
||||
|
||||
Monday, December 29th, 2022.
|
||||
Written by [Netkas](https://git.n64.cc/netkas)
|
35
docs/instructions/base/set.md
Normal file
35
docs/instructions/base/set.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# set
|
||||
|
||||
Sets aor overwrites a variable in the environment.
|
||||
|
||||
## Parameters
|
||||
|
||||
* name (`string`, `instruction`) - The name of the variable to get.
|
||||
* value (`any`, `instruction`) - The value to set.
|
||||
|
||||
## Return
|
||||
|
||||
(`null`) - Nothing.
|
||||
|
||||
## Exceptions
|
||||
|
||||
* `EvaluationException` - If there was an error while evaluating one or more parameters.
|
||||
* `TypeException` - If one or more parameters are not of the expected type.
|
||||
|
||||
|
||||
## Instruction Example
|
||||
|
||||
```json
|
||||
{
|
||||
"type": "set",
|
||||
"_": {
|
||||
"name": "foo",
|
||||
"value": "bar"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Last Updated
|
||||
|
||||
Monday, December 29th, 2022.
|
||||
Written by [Netkas](https://git.n64.cc/netkas)
|
Loading…
Add table
Add a link
Reference in a new issue