Files
Basalt/docs/objects/Program/onDone.md
Robert Jelic bb1b1beb79 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
2023-04-30 17:05:34 +02:00

923 B

onDone

Description

onDone(self, err)

This is a custom event which gets triggered as soon as the program has finished.

Returns

  1. object The object in use

Usage

local basalt = require("basalt")

local main = basalt.createFrame()
local aProgram = main:addProgram():execute("rom/programs/shell.lua")

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.