(state: &mut State<'gc>, args: Vec<Value<'gc>>)
| 135 | } |
| 136 | |
| 137 | fn io_input<'gc>(state: &mut State<'gc>, args: Vec<Value<'gc>>) -> Result<Value<'gc>, VmError> { |
| 138 | // Optional input |
| 139 | if let Some(value) = args.first() { |
| 140 | let input = value.as_string()?.to_string(); |
| 141 | print!("{}", input); |
| 142 | io::stdout() |
| 143 | .flush() |
| 144 | .map_err(|e| VmError::RuntimeError(format!("Failed to flush stdout: {}", e)))?; |
| 145 | } |
| 146 | |
| 147 | let mut input = String::new(); |
| 148 | io::stdin() |
| 149 | .read_line(&mut input) |
| 150 | .map_err(|e| VmError::RuntimeError(format!("Failed to read input: {}", e)))?; |
| 151 | |
| 152 | // Trim the trailing newline |
| 153 | Ok(Value::IoString(Gc::new(state, input.trim_end().to_owned()))) |
| 154 | } |
| 155 | |
| 156 | // File/directory operations |
| 157 | fn io_exists<'gc>(_state: &mut State<'gc>, args: Vec<Value<'gc>>) -> Result<Value<'gc>, VmError> { |
nothing calls this directly
no test coverage detected