- 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
992 B
992 B
injectEvent
Description
Injects an event into the program manually. For example, you could inject "w", "a", "s", and "d" for the worm game by clicking buttons.
Parameters
stringeventbooleanif this is true, the injected event will be executed even if the program is pausedany... parameters
Returns
objectThe object in use
Usage
- Inject an event by clicking a button
local basalt = require("basalt")
local mainFrame = basalt.createFrame()
local aProgram = mainFrame:addProgram():execute("rom/programs/shell.lua")
local function injectEventOnClick()
aProgram:injectEvent("char", false, "w")
end
mainFrame:addButton()
:setText("Inject W")
:onClick(injectEventOnClick)
In this example, a Program object is created, added to the mainFrame, and the "rom/programs/shell.lua" script is executed. A button is then added to the mainFrame that, when clicked, injects the "char" event with a parameter of "w" into the Program.