MCPcopy Index your code
hub / github.com/aiscriptdev/aiscript / env_args

Function env_args

aiscript-vm/src/stdlib/env.rs:27–35  ·  view source on GitHub ↗

Returns command-line arguments as an array of strings

(state: &mut State<'gc>, _args: Vec<Value<'gc>>)

Source from the content-addressed store, hash-verified

25
26// Returns command-line arguments as an array of strings
27fn 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
38fn env_vars<'gc>(state: &mut State<'gc>, _args: Vec<Value<'gc>>) -> Result<Value<'gc>, VmError> {

Callers

nothing calls this directly

Calls 3

get_contextMethod · 0.80
as_bytesMethod · 0.80
internMethod · 0.45

Tested by

no test coverage detected