length() max args check

This commit is contained in:
ConnorSkees 2020-03-20 10:03:54 -04:00
parent 2db2ab10ca
commit ef480ad1f8

View File

@ -8,6 +8,7 @@ pub(crate) fn register(f: &mut HashMap<String, Builtin>) {
f.insert(
"length".to_owned(),
Box::new(|args, _| {
max_args!(args, 1);
let len = match arg!(args, 0, "list") {
Value::List(v, _) => Number::from(v.len()),
_ => Number::from(1),