Lua primitives: on_key()
If you define the function on_key it will be called when the user presses any key.
Keyboard bindings are generally setup via the keymap table, but it might be useful to allow processing to happen via Lua too.
function on_key() if ( k == "x" ) then msg("The user pressed 'x'" ); -- The key was handled. Don't do our keymap lookup return 1; else -- continue processing. return 0; end end
This function has been available since version 0.07.