aboutsummaryrefslogtreecommitdiff
path: root/api/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'api/util.c')
-rw-r--r--api/util.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/api/util.c b/api/util.c
new file mode 100644
index 0000000..c3e8a38
--- /dev/null
+++ b/api/util.c
@@ -0,0 +1,15 @@
+#include "../src/err.h"
+#include "util.h"
+#include "bool.h"
+
+UwUVMValue uwuutil_is_type(const char *fnname, UwUVMArgs *args, UwUVMType *type)
+{
+ if (args->num < 1)
+ error("error: %s requires at least one argument\n", fnname);
+
+ for (size_t i = 0; i < args->num; i++)
+ if (uwuvm_get_arg(args, i).type != type)
+ return uwubool_create(false);
+
+ return uwubool_create(true);
+}