1
0
mirror of https://github.com/janet-lang/janet synced 2025-04-07 15:56:39 +00:00

Change function arity error message.

This commit is contained in:
Calvin Rose 2018-08-03 19:46:15 -04:00
parent 06c755c98a
commit 9cad4eb91d

@ -1195,9 +1195,11 @@ static void *op_lookup[255] = {
/* Handle function calls with bad arity */
vm_arity_error:
{
retreg = dst_wrap_string(dst_formatc("calling %V got %d arguments, expected %d",
int32_t nargs = fiber->stacktop - fiber->stackstart;
retreg = dst_wrap_string(dst_formatc("%V called with %d argument%s, expected %d",
dst_wrap_function(func),
fiber->stacktop - fiber->stackstart,
nargs,
nargs == 1 ? "" : "s",
func->def->arity));
signal = DST_SIGNAL_ERROR;
goto vm_exit;