Skip to content
dragekk edited this page Feb 24, 2023 · 6 revisions

Events

events is variable stored in app variable that you get when creating app app.events, its a table with all events

OPEN(...)

open event is called when app is opened

... are arguments provided by other app that opened this app

CLOSE()

close event is called when app is closed

TICK()

called 20 times per second

RENDER(delta)

render event is executed every frame

KEY_PRESS(pressed_key)

called when key is pressed (left, right, down, up arrows and enter, backspace)

POST_KEY_PRESS(pressed_key)

called after key is pressed and after all actions by key has been executed

KEYBOARD(text, confirm)

text is text typed in chat, if nil message is being cancelled confirm is boolean, false when message is still typed, true when it is sent

examples

-- create init event and change page to "menu"
function events.open()
    app.setPage("menu")
end
-- change text of first element on main page to pressed key
events.KEY_PRESS:register(function(key)
    app.pages.main[1].text = key
end