length() max args check
This commit is contained in:
parent
2db2ab10ca
commit
ef480ad1f8
@ -8,6 +8,7 @@ pub(crate) fn register(f: &mut HashMap<String, Builtin>) {
|
|||||||
f.insert(
|
f.insert(
|
||||||
"length".to_owned(),
|
"length".to_owned(),
|
||||||
Box::new(|args, _| {
|
Box::new(|args, _| {
|
||||||
|
max_args!(args, 1);
|
||||||
let len = match arg!(args, 0, "list") {
|
let len = match arg!(args, 0, "list") {
|
||||||
Value::List(v, _) => Number::from(v.len()),
|
Value::List(v, _) => Number::from(v.len()),
|
||||||
_ => Number::from(1),
|
_ => Number::from(1),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user