1.6 KiB
1.6 KiB
Program : VisualElement
This is the program class. It provides a program that runs in a window.
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 |
Functions
| Method | Returns | Description |
|---|---|---|
| Program.new | Program | Creates a new Program instance |
| Program:dispatchEvent | any | Handles all incomming events |
| Program:execute | Program | Executes a program |
| Program:focus | - | Gets called when the element gets focused |
| Program:init | Program | Initializes the Program instance |
| Program:render | - | Renders the program |
Program.new()
Creates a new Program instance
Returns
ProgramobjectThe newly created Program instance
Usage
local element = Program.new("myId", basalt)
Program:dispatchEvent(event, ...)
Handles all incomming events
Parameters
eventstringThe event to handle...anyThe event arguments
Returns
anyresultThe event result
Program:execute(path)
Executes a program
Parameters
pathstringThe path to the program
Returns
ProgramselfThe Program instance
Program:focus()
Gets called when the element gets focused
Program:init(props, basalt)
Initializes the Program instanceProperty
Parameters
propstableThe properties to initialize the element withbasalttableThe basalt instance
Returns
ProgramselfThe initialized instance
Program:render()
Renders the program