(ctx: Context)
| 8 | }; |
| 9 | |
| 10 | pub fn create_env_module(ctx: Context) -> ModuleKind { |
| 11 | let name = ctx.intern(b"std.env"); |
| 12 | |
| 13 | let exports = [ |
| 14 | ("args", Value::NativeFunction(NativeFn(env_args))), |
| 15 | ("vars", Value::NativeFunction(NativeFn(env_vars))), |
| 16 | ("get_env", Value::NativeFunction(NativeFn(env_get))), |
| 17 | ("set_env", Value::NativeFunction(NativeFn(env_set))), |
| 18 | ] |
| 19 | .into_iter() |
| 20 | .map(|(name, f)| (ctx.intern_static(name), f)) |
| 21 | .collect(); |
| 22 | |
| 23 | ModuleKind::Native { name, exports } |
| 24 | } |
| 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> { |
no test coverage detected