MCPcopy Create free account
hub / github.com/aiscriptdev/aiscript / all

Function all

aiscript-vm/src/builtins/mod.rs:172–188  ·  view source on GitHub ↗
(_state: &mut State<'gc>, args: Vec<Value<'gc>>)

Source from the content-addressed store, hash-verified

170}
171
172fn all<'gc>(_state: &mut State<'gc>, args: Vec<Value<'gc>>) -> Result<Value<'gc>, VmError> {
173 if args.len() != 1 {
174 return Err(VmError::RuntimeError(
175 "all() takes exactly one argument.".into(),
176 ));
177 }
178
179 match &args[0] {
180 Value::List(arr) => {
181 let arr = arr.borrow();
182 Ok(Value::Boolean(arr.data.iter().all(|x| x.is_true())))
183 }
184 _ => Err(VmError::RuntimeError(
185 "all() argument must be an array.".into(),
186 )),
187 }
188}
189
190fn min<'gc>(_state: &mut State<'gc>, args: Vec<Value<'gc>>) -> Result<Value<'gc>, VmError> {
191 if args.is_empty() {

Callers

nothing calls this directly

Calls 4

RuntimeErrorClass · 0.85
lenMethod · 0.80
is_trueMethod · 0.80
borrowMethod · 0.45

Tested by

no test coverage detected