feat: implement IO.read method with stdin input buffer and prompt support
Add static `IO.read(prompt)` method to the IO class that writes the prompt to stdout and reads a line from stdin into a 1024-byte buffer. The C implementation uses `fgets` for input and returns the string via `wrenReturnString`. The Wren wrapper calls `IO.write` for the prompt before delegating to the native `IO.read` method.
This commit is contained in:
@@ -78,4 +78,9 @@ class IO {
|
||||
IO.writeString_(obj.toString)
|
||||
return obj
|
||||
}
|
||||
|
||||
static read(prompt) {
|
||||
IO.write(prompt)
|
||||
return IO.read
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user