]> git.lizzy.rs Git - uwu-lang.git/blob - api/util.c
e6f06502ffdcc0751713b37f5d0f14180eb36820
[uwu-lang.git] / api / util.c
1 #include "common/err.h"
2 #include "util.h"
3 #include "bool.h"
4
5 UwUVMValue uwuutil_is_type(const char *fnname, UwUVMArgs *args, UwUVMType *type)
6 {
7         if (args->num < 1)
8                 error("error: %s requires at least one argument\n", fnname);
9
10         for (size_t i = 0; i < args->num; i++)
11                 if (uwuvm_get_arg(args, i).type != type)
12                         return uwubool_create(false);
13
14         return uwubool_create(true);
15 }