Sets the value of an environment variable
(_state: &mut State<'gc>, args: Vec<Value<'gc>>)
| 66 | |
| 67 | // Sets the value of an environment variable |
| 68 | fn env_set<'gc>(_state: &mut State<'gc>, args: Vec<Value<'gc>>) -> Result<Value<'gc>, VmError> { |
| 69 | if args.len() != 2 { |
| 70 | return Err(VmError::RuntimeError( |
| 71 | "set_env() requires two arguments: variable name and value".into(), |
| 72 | )); |
| 73 | } |
| 74 | |
| 75 | let var_name = args[0].as_string()?.to_str().unwrap(); |
| 76 | let value = args[1].as_string()?.to_str().unwrap(); |
| 77 | |
| 78 | unsafe { std::env::set_var(var_name, value) }; |
| 79 | Ok(Value::Nil) |
| 80 | } |
nothing calls this directly
no test coverage detected