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

27 lines
467 B
Markdown

# 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:
```lua
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)
```