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,9 +1,16 @@
|
||||
# onDone
|
||||
## onDone
|
||||
|
||||
### Description
|
||||
|
||||
`onDone(self, err)`
|
||||
|
||||
`onDone(self, err)`<br>
|
||||
This is a custom event which gets triggered as soon as the program has finished.
|
||||
|
||||
Here is a example on how to add a onDone event to your program:
|
||||
### Returns
|
||||
|
||||
1. `object` The object in use
|
||||
|
||||
### Usage
|
||||
|
||||
```lua
|
||||
local basalt = require("basalt")
|
||||
@@ -11,9 +18,15 @@ local basalt = require("basalt")
|
||||
local main = basalt.createFrame()
|
||||
local aProgram = main:addProgram():execute("rom/programs/shell.lua")
|
||||
|
||||
local function onProgramDone()
|
||||
basalt.debug("Program has finished")
|
||||
local function onProgramDone(self, err)
|
||||
if err then
|
||||
basalt.debug("Program finished with error:", err)
|
||||
else
|
||||
basalt.debug("Program has finished successfully")
|
||||
end
|
||||
end
|
||||
|
||||
aProgram:onDone(onProgramDone)
|
||||
```
|
||||
|
||||
In this example, a Program object is created, added to the mainFrame, and the "rom/programs/shell.lua" script is executed. The `onDone` event is then attached to the program, and it will be triggered when the program finishes. The event function, `onProgramDone`, will print a debug message indicating whether the program finished successfully or with an error.
|
||||
|
||||
Reference in New Issue
Block a user