lua: separate and rework input handling

Handle also modifier keys (shift, alt, control) now.