Returns command-line arguments as an array of strings
(state: &mut State<'gc>, _args: Vec<Value<'gc>>)
| 25 | |
| 26 | // Returns command-line arguments as an array of strings |
| 27 | fn env_args<'gc>(state: &mut State<'gc>, _args: Vec<Value<'gc>>) -> Result<Value<'gc>, VmError> { |
| 28 | let ctx = state.get_context(); |
| 29 | |
| 30 | let args: Vec<Value<'gc>> = std::env::args() |
| 31 | .map(|arg| Value::String(ctx.intern(arg.as_bytes()))) |
| 32 | .collect(); |
| 33 | |
| 34 | Ok(Value::array(&ctx, args)) |
| 35 | } |
| 36 | |
| 37 | // Returns all environment variables as an object |
| 38 | fn env_vars<'gc>(state: &mut State<'gc>, _args: Vec<Value<'gc>>) -> Result<Value<'gc>, VmError> { |
nothing calls this directly
no test coverage detected