-- find out what numeric key code is generated by any key on the keyboard -- usage: -- exu key_esc_utf.ex integer code puts(1, "Press any key. I'll show you the key code. Press q to quit\n\n") while 1 do code = get_key() if code != -1 then if code = 27 then puts(1,'\n') puts(1, "Key [Esc] or sequence Esc+") while 1 do code = get_key() if code != -1 then puts(1, code) else exit end if end while elsif code > 127 then puts(1,'\n') puts(1, "Foreign register or UTF-8 codes") printf(1, " - %d", code) while 1 do code = get_key() if code != -1 then printf(1, ", %d", code) -- puts(1, code) else exit end if end while else puts(1,'\n') puts(1, "Key") puts(1, " -[" & code & "]- ") printf(1, "the key code is: %d", code) if code = 'q' then puts(1, '\n') exit end if end if end if end while