summaryrefslogtreecommitdiffstats
path: root/src/typval.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/typval.c')
-rw-r--r--src/typval.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/typval.c b/src/typval.c
index b223318311..6e0b528e79 100644
--- a/src/typval.c
+++ b/src/typval.c
@@ -385,6 +385,23 @@ check_for_nonempty_string_arg(typval_T *args, int idx)
}
/*
+ * Give an error and return FAIL unless "tv" is a number.
+ */
+ int
+check_for_number_arg(typval_T *args, int idx)
+{
+ if (args[idx].v_type != VAR_NUMBER)
+ {
+ if (idx >= 0)
+ semsg(_(e_number_required_for_argument_nr), idx + 1);
+ else
+ emsg(_(e_numberreq));
+ return FAIL;
+ }
+ return OK;
+}
+
+/*
* Give an error and return FAIL unless "tv" is a dict.
*/
int