Files
Basalt/docs/objects/Object/onKey.md
Robert Jelic ab72f244ed Updated some formatting
Updated formatting for object
2022-10-20 21:05:29 +02:00

467 B

Object - Event

onKey

onKey(self, event, key)

The computercraft event which triggers this method is key and char.

Here is a example on how to add a onKey event to your frame:

local basalt = require("basalt")

local main = basalt.createFrame()
local subFrame = main:addFrame()
  :setPosition(3,3)
  :setSize(18,6)
  :hide()

function openSubFrame(self, event, key)
  if(key==keys.c)then
    subFrame:show()
  end
end
main:onKey(openSubFrame)