Skip to main content

input

One frame of input: the keyboard, mouse, touch screen and gamepads as they stand now, plus the edges — what went down or came up this frame. Nothing feeds it in a headless run, where every query answers neutrally rather than failing.

27 functions, 190 constants. Scripts reach it as input::.

Functions

Argument kinds are the script values a call passes: node is a node handle, any a table or value of any kind, fn a callback.

functionacts onwhat it does
action_just_pressed(string) -> boolWhether the action went down this frame.
action_just_released(string) -> boolWhether the action came up this frame.
action_pressed(string) -> boolWhether the action is held down now.
action_value(string) -> floatHow far the action is pushed, -1 to 1; a key answers 0 or 1, a stick or keys:A,D the whole range.
actions() -> anyEvery action [input.actions] declares, so a rebinding screen can list them.
bind(string, any)Rebind the action to one binding or a list of them, replacing what it had and saving to the user data directory.
bindings(string) -> anyWhat the action is bound to now, whether from the project or from the player's own rebinding.
dropped_files() -> anyThe absolute paths of files dropped onto the window this frame, in drop order; desktop only.
gamepad_axis(int, string) -> floatHow far the pad's AXIS_* stick or trigger is pushed, -1 to 1; zero at rest and for an absent pad.
gamepad_down(int, string) -> boolWhether the pad's PAD_* button is held down right now, however many frames it has been down.
gamepad_just_pressed(int, string) -> boolWhether the pad's PAD_* button went down this frame; true for that one frame only.
gamepad_just_released(int, string) -> boolWhether the pad's PAD_* button came up this frame; true for that one frame only.
gamepad_name(int) -> stringThe pad's name as the platform reports it, empty when no pad has that id.
gamepads() -> anyThe ids of every connected pad, ordered so the list is stable from frame to frame.
is_down(string) -> boolWhether the KEY_* key is held down right now, however many frames it has been down.
is_mouse_down(int) -> boolWhether the MOUSE_* button is held down right now, however many frames it has been down.
just_pressed(string) -> boolWhether the KEY_* key went down this frame; true for that one frame only.
just_released(string) -> boolWhether the KEY_* key came up this frame; true for that one frame only.
mouse_delta() -> float, floatHow far the cursor moved this frame, in pixels; movement, not a position.
mouse_just_pressed(int) -> boolWhether the MOUSE_* button went down this frame; true for that one frame only.
mouse_just_released(int) -> boolWhether the MOUSE_* button came up this frame; true for that one frame only.
mouse_position() -> float, floatThe cursor's position in window pixels, with (0, 0) at the top-left corner.
reset_bindings()Drop every saved rebinding and go back to what the project declared.
scroll_delta() -> float, floatHow far the wheel turned this frame, as an (x, y) pair; zero when it did not turn.
touches() -> anyEvery finger on the screen as { id, x, y }, oldest first, in the same pixels as mouse_position.
touches_ended() -> anyThe ids of the fingers that lifted or were cancelled this frame.
touches_started() -> anyThe ids of the fingers that touched down this frame.

Constants

namevalue
AXIS_DPAD_XDPadX
AXIS_DPAD_YDPadY
AXIS_LEFT_STICK_XLeftStickX
AXIS_LEFT_STICK_YLeftStickY
AXIS_LEFT_ZLeftZ
AXIS_RIGHT_STICK_XRightStickX
AXIS_RIGHT_STICK_YRightStickY
AXIS_RIGHT_ZRightZ
KEY_0Key0
KEY_1Key1
KEY_2Key2
KEY_3Key3
KEY_4Key4
KEY_5Key5
KEY_6Key6
KEY_7Key7
KEY_8Key8
KEY_9Key9
KEY_AA
KEY_ABNT_C1AbntC1
KEY_ABNT_C2AbntC2
KEY_ADDAdd
KEY_APOSTROPHEApostrophe
KEY_APPSApps
KEY_ATAt
KEY_AXAx
KEY_BB
KEY_BACKBack
KEY_BACKSLASHBackslash
KEY_CC
KEY_CALCULATORCalculator
KEY_CAPITALCapital
KEY_CARETCaret
KEY_COLONColon
KEY_COMMAComma
KEY_COMPOSECompose
KEY_CONVERTConvert
KEY_COPYCopy
KEY_CUTCut
KEY_DD
KEY_DECIMALDecimal
KEY_DELETEDelete
KEY_DIVIDEDivide
KEY_DOWNDown
KEY_EE
KEY_ENDEnd
KEY_EQUALSEquals
KEY_ESCAPEEscape
KEY_FF
KEY_F1F1
KEY_F10F10
KEY_F11F11
KEY_F12F12
KEY_F13F13
KEY_F14F14
KEY_F15F15
KEY_F16F16
KEY_F17F17
KEY_F18F18
KEY_F19F19
KEY_F2F2
KEY_F20F20
KEY_F21F21
KEY_F22F22
KEY_F23F23
KEY_F24F24
KEY_F3F3
KEY_F4F4
KEY_F5F5
KEY_F6F6
KEY_F7F7
KEY_F8F8
KEY_F9F9
KEY_GG
KEY_GRAVEGrave
KEY_HH
KEY_HOMEHome
KEY_II
KEY_INSERTInsert
KEY_JJ
KEY_KK
KEY_KANAKana
KEY_KANJIKanji
KEY_LL
KEY_LALTLAlt
KEY_LBRACKETLBracket
KEY_LCONTROLLControl
KEY_LEFTLeft
KEY_LSHIFTLShift
KEY_LWINLWin
KEY_MM
KEY_MAILMail
KEY_MEDIA_SELECTMediaSelect
KEY_MEDIA_STOPMediaStop
KEY_MINUSMinus
KEY_MULTIPLYMultiply
KEY_MUTEMute
KEY_MY_COMPUTERMyComputer
KEY_NN
KEY_NAVIGATE_BACKWARDNavigateBackward
KEY_NAVIGATE_FORWARDNavigateForward
KEY_NEXT_TRACKNextTrack
KEY_NO_CONVERTNoConvert
KEY_NUMLOCKNumlock
KEY_NUMPAD0Numpad0
KEY_NUMPAD1Numpad1
KEY_NUMPAD2Numpad2
KEY_NUMPAD3Numpad3
KEY_NUMPAD4Numpad4
KEY_NUMPAD5Numpad5
KEY_NUMPAD6Numpad6
KEY_NUMPAD7Numpad7
KEY_NUMPAD8Numpad8
KEY_NUMPAD9Numpad9
KEY_NUMPAD_COMMANumpadComma
KEY_NUMPAD_ENTERNumpadEnter
KEY_NUMPAD_EQUALSNumpadEquals
KEY_OO
KEY_OEM102OEM102
KEY_PP
KEY_PAGE_DOWNPageDown
KEY_PAGE_UPPageUp
KEY_PASTEPaste
KEY_PAUSEPause
KEY_PERIODPeriod
KEY_PLAY_PAUSEPlayPause
KEY_POWERPower
KEY_PREV_TRACKPrevTrack
KEY_QQ
KEY_RR
KEY_RALTRAlt
KEY_RBRACKETRBracket
KEY_RCONTROLRControl
KEY_RETURNReturn
KEY_RIGHTRight
KEY_RSHIFTRShift
KEY_RWINRWin
KEY_SS
KEY_SCROLLScroll
KEY_SEMICOLONSemicolon
KEY_SLASHSlash
KEY_SLEEPSleep
KEY_SNAPSHOTSnapshot
KEY_SPACESpace
KEY_STOPStop
KEY_SUBTRACTSubtract
KEY_SYSRQSysrq
KEY_TT
KEY_TABTab
KEY_UU
KEY_UNDERLINEUnderline
KEY_UNKNOWNUnknown
KEY_UNLABELEDUnlabeled
KEY_UPUp
KEY_VV
KEY_VOLUME_DOWNVolumeDown
KEY_VOLUME_UPVolumeUp
KEY_WW
KEY_WAKEWake
KEY_WEB_BACKWebBack
KEY_WEB_FAVORITESWebFavorites
KEY_WEB_FORWARDWebForward
KEY_WEB_HOMEWebHome
KEY_WEB_REFRESHWebRefresh
KEY_WEB_SEARCHWebSearch
KEY_WEB_STOPWebStop
KEY_XX
KEY_YY
KEY_YENYen
KEY_ZZ
MOUSE_LEFT0
MOUSE_MIDDLE2
MOUSE_RIGHT1
PAD_DPAD_DOWNDPadDown
PAD_DPAD_LEFTDPadLeft
PAD_DPAD_RIGHTDPadRight
PAD_DPAD_UPDPadUp
PAD_EASTEast
PAD_LEFT_THUMBLeftThumb
PAD_LEFT_TRIGGERLeftTrigger
PAD_LEFT_TRIGGER2LeftTrigger2
PAD_MODEMode
PAD_NORTHNorth
PAD_RIGHT_THUMBRightThumb
PAD_RIGHT_TRIGGERRightTrigger
PAD_RIGHT_TRIGGER2RightTrigger2
PAD_SELECTSelect
PAD_SOUTHSouth
PAD_STARTStart
PAD_WESTWest