3.2 KiB
3.2 KiB
Program
This is the program class. It provides a program that runs in a window.
Extends: VisualElement
Properties
| 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 |
Functions
| Method | Returns | Description |
|---|---|---|
| Program.new | - | |
| Program:BasaltProgram | - | |
| Program:BasaltProgram | - | |
| Program:BasaltProgram | - | |
| Program:BasaltProgram | - | |
| Program.new | Program | Creates a new Program instance |
| Program:Program | Program | Initializes the Program instance |
| Program:Program | Program | Executes a program |
| Program:Program | Program | Stops the program |
| Program:Program | Program | Sends an event to the program |
| Program:Program | Program | Registers a callback for the program's error event |
| Program:Program | Program | Registers a callback for the program's done event |
| Program:Program | any | Handles all incomming events |
| Program:Program | - | Gets called when the element gets focused |
| Program:Program | - | Renders the program |
Program.new()
Program:BasaltProgram()
Program:BasaltProgram()
Program:BasaltProgram()
Program:BasaltProgram()
Program.new()
Returns
ProgramobjectThe newly created Program instance
Program:Program(props, basalt)
Parameters
propstableThe properties to initialize the element withbasalttableThe basalt instance
Returns
ProgramselfThe initialized instance
Program:Program(path, env?, addEnvironment?)
Executes a program
Parameters
pathstringThe path to the programenv(optional)tableThe environment to run the program inaddEnvironment(optional)booleanWhether to add the environment to the program's environment (false = overwrite instead of adding)
Returns
ProgramselfThe Program instance
Program:Program()
Stops the program
Returns
ProgramselfThe Program instance
Program:Program(event, any)
Sends an event to the program
Parameters
eventstringThe event to sendanyTheevent arguments
Returns
ProgramselfThe Program instance
Program:Program(fn)
Registers a callback for the program's error event, if the function returns false, the program won't stop
Parameters
fnfunctionThe callback function to register
Returns
ProgramselfThe Program instance
Program:Program(fn)
Registers a callback for the program's done event
Parameters
fnfunctionThe callback function to register
Returns
ProgramselfThe Program instance
Program:Program(event, any)
Parameters
eventstringThe event to handleanyTheevent arguments
Returns
anyresultThe event result