I used import: console to import the #key. I see it's a method of the console class and I'm still a little fuzzy on how it can be used within my class of objects.
As you well know, in ANSI FORTH the word "KEY" waits for a key press and returns it's ascii value. How would you setup oforth's #key to work the same way?
Example:
- Code: Select all
import: console
: wait1s \ -- x | null 1000000 System.Console receiveTimeout ;
: foo doWhile: [ 7 emit wait1s dup key 27 == if drop false else drop true then ] ;
I always get an integer 27 does not understand #key.