如何从 red/rebol 中的键盘读取键

How to read key from keyboad in red/rebol

我们可以通过inputask从控制台获取输入,这意味着按下键盘上的某些键并通过按下“Enter”键终止输入。 我想知道有没有办法得到一个按键输入,也就是说,只要按键盘上的一个键,然后就会发生一些事情,就像这样:

if read-key = #"a" [do something...] ;;if the key "a" on keyboard is pressed, something is done immediately--not by pressing the key "Enter" after pressing "a".

如果没有这个any-function!像red/rebol中的read-way,如何实现?

在 Rebol2 上这应该有效:

>> console-port: open/binary [scheme: 'console]
>> pick console-port 1 ; hit space
== 32

>> to char! pick console-port 1  ;hit x
== #"x"