Files
Basalt/docs/docs1_6/objects/Program/injectEvent.md
Robert Jelic d4c72514ef Docs 1.6
Accidentally uploaded outdated 1.6 docs
2023-05-01 16:28:46 +02:00

678 B

injectEvent

injects a event into the program manually. For example you could inject w a s and d for worm, by clicking buttons.

Parameters:

  1. string event
  2. any parameter
  3. any parameter
  4. any parameter
  5. any parameter
  6. boolean if this is true, the injected event will be executed even if the program is paused

Returns:

  1. object The object in use

Usage:

  • injects a event by clicking a button
local mainFrame = basalt.createFrame():show()
local aProgram = mainFrame:addProgram():execute("rom/programs/shell.lua"):show()
mainFrame:addButton():setText("inject"):onClick(function() aProgram:injectEvent("char", "w") end):show()