Skip to main content

Variable

Inputs: i1
Outputs: o1
Controls: c1

The Variable operator is a special operator designed to store stateful computations.

The Variable has one data input port i1, one control port c1 and one output port o1. Messages received through the data input port are considered definitions for the values of the variable from the time of the message up to the next different message time.

Messages received through the control port c1 will trigger the emission of the value of the variable, according with the time present in the control message, through o1.

Parameters

id: The id of the operator

value: The default value of the variable

Usage

import { Program, Variable } from "@rtbot-dev/rtbot";

const id = "id";
const value = 1.618;

const program = new Program();
program.addOperator(new Variable(id, value));