KEY_ESCAPE
Posted: Wed Jun 26, 2024 11:04 pm
I need to know when escape key pressed on keyboard, but the keycode will return -51.0 and 27.0, which is not the constant LM.GUI.KEY_ESCAPE = -2
Code: Select all
-- **************************************************
-- General information about this script
-- **************************************************
ScriptName = "Test_Script"
Test_Script = {}
-- **************************************************
-- Events
-- **************************************************
function Test_Script:OnMouseDown(moho, mouseEvent)
end
function Test_Script:OnKeyDown(moho, keyEvent)
print(tostring(keyEvent.keyCode))
if keyEvent.keyCode == LM.GUI.KEY_ESCAPE then
print('Escape key pressed.')
end
end