import{_ as r,a as t,b as a,ag as o}from"./chunks/framework.BcrMLAmg.js";const u=JSON.parse('{"title":"Program","description":"","frontmatter":{},"headers":[],"relativePath":"references/elements/Program.md","filePath":"references/elements/Program.md","lastUpdated":1757844696000}'),n={name:"references/elements/Program.md"};function d(i,e,s,l,h,c){return a(),t("div",null,e[0]||(e[0]=[o('
This is the program class. It provides a program that runs in a window.
Extends: VisualElement
| Property | Type | Default | Description |
|---|---|---|---|
| program | table | nil | The program instance |
| path | string | "" | The path to the program |
| running | boolean | false | Whether the program is running |
| errorCallback | function | nil | The error callback function |
| doneCallback | function | nil | The done callback function |
| Method | Returns | Description |
|---|---|---|
| Program:execute | Program | Executes a program |
| Program:stop | Program | Stops the program |
| Program:sendEvent | Program | Sends an event to the program |
| Program:onError | Program | Registers a callback for the program's error event |
| Program:onDone | Program | Registers a callback for the program's done event |
Executes a program
path string The path to the programenv (optional) table The environment to run the program inaddEnvironment (optional) boolean Whether to add the environment to the program's environment (false = overwrite instead of adding)Program self The Program instanceStops the program
Program self The Program instanceSends an event to the program
event string The event to sendany The event argumentsProgram self The Program instanceRegisters a callback for the program's error event, if the function returns false, the program won't stop
fn function The callback function to registerProgram self The Program instanceRegisters a callback for the program's done event
fn function The callback function to registerProgram self The Program instance