Basalt 1.7 Update
- New Objects (Flexbox, Graph, Treeview) - Pluginsystem to add/remove functionality - Reworked the entire Object system, instead of one big Object Class we have multiple classes: Object, VisualObject, ChangeableObject - Instead of one big Frame Class we have multiple Frame Classes: BaseFrame, Frame, MovableFrame, ScrollableFrame, MonitorFrame, Flexbox - Removed the Animation Object, and added a animation plugin instead - Removed the Graphic Object and merged it's functionality with the image object - Updated currently existing objects
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
Program objects are here for opening other executable programs in your main program. You can execute worms, shell or any custom program you've made.
|
||||
Program objects allow you to execute other programs within your main application. You can run programs such as worms, shell, or any custom programs you've created. This object also has two unique events: onError and onDone.
|
||||
|
||||
[Object](objects/Object.md) methods also apply for programs.
|
||||
In addition to the Object and VisualObject methods, lists also have the following methods:
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
@@ -9,16 +9,37 @@ Program objects are here for opening other executable programs in your main prog
|
||||
|[stop](objects/Program/stop.md)|Stops the currently running program
|
||||
|[pause](objects/Program/pause.md)|Pauses the currently running program
|
||||
|[isPaused](objects/Program/isPaused.md)|Returns if the program is paused
|
||||
|[injectEvent](objects/Program/injectEvent.md)|Injects a event into the program
|
||||
|[injectEvent](objects/Program/injectEvent.md)|Injects an event into the program
|
||||
|[injectEvents](objects/Program/injectEvents.md)|Injects a table of events
|
||||
|[getQueuedEvents](objects/Program/getQueuedEvents.md)|Returns currently queued events
|
||||
|[setEnviroment](objects/Program/setEnviroment.md)|Changes the default enviroment to a custom one
|
||||
|[setEnviroment](objects/Program/setEnviroment.md)|Changes the default environment to a custom one
|
||||
|
||||
# Events
|
||||
## Events
|
||||
|
||||
This is a list of all available events for programs:
|
||||
|
||||
| | |
|
||||
|---|---|
|
||||
|[onError](objects/Program/onError.md)|Fires when a program errors
|
||||
|[onDone](objects/Program/onDone.md)|Fires when a program has finished
|
||||
|[onError](objects/Program/onError.md)|Fires when a program encounters an error
|
||||
|[onDone](objects/Program/onDone.md)|Fires when a program has finished executing
|
||||
|
||||
Here's an example of how to create a Program object, execute a program, and handle events:
|
||||
|
||||
Lua:
|
||||
|
||||
```lua
|
||||
local mainFrame = basalt.createFrame()
|
||||
local aProgram = mainFrame:addProgram()
|
||||
|
||||
aProgram:onError(function(self, event, err)
|
||||
basalt.log("An error occurred: " .. err)
|
||||
end)
|
||||
|
||||
aProgram:onDone(function()
|
||||
basalt.debug("Program finished successfully")
|
||||
end)
|
||||
|
||||
aProgram:execute("path/to/your/program.lua")
|
||||
```
|
||||
|
||||
This example demonstrates how to create a Program object, execute a program located at "path/to/your/program", and handle the onError and onDone events.
|
||||
|
||||
Reference in New Issue
Block a user