feat: add IO.read method with prompt and stdin input buffer
Implement a new static `IO.read(prompt)` method in the IO class that writes a prompt string to stdout and reads a line from stdin into a fixed 1024-byte buffer. The C implementation adds a `MAX_READ_LEN` constant, an `ioRead` function using `fgets`, and registers the method via `wrenDefineStaticMethod`. The builtin source string is updated to include the new Wren method definition.
This commit is contained in:
@@ -79,6 +79,11 @@ class IO {
|
||||
return obj
|
||||
}
|
||||
|
||||
static read(prompt) {
|
||||
IO.write(prompt)
|
||||
return IO.read
|
||||
}
|
||||
|
||||
static writeObject_(obj) {
|
||||
var string = obj.toString
|
||||
if (string is String) {
|
||||
|
||||
Reference in New Issue
Block a user