rtex-engine/docs/instructions/base/invoke.md

1.1 KiB

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

{
  "type": "invoke",
  "_": {
    "namespace": "system",
    "method": "print",
    "parameters": {
      "value": "Hello, world!"
    },
    "fail_on_error": true
  }
}

Last Updated

Monday, December 29th, 2022. Written by Netkas