From 7e4e034a327ca5a4621f2b5931fd3aa1bad078d1 Mon Sep 17 00:00:00 2001 From: Darxo Date: Sat, 17 Feb 2024 15:33:49 +0100 Subject: [PATCH] feat: add type checker for unsigned integers --- msu/utils/type_checkers.nut | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/msu/utils/type_checkers.nut b/msu/utils/type_checkers.nut index 8a8eb4202..477d819c2 100644 --- a/msu/utils/type_checkers.nut +++ b/msu/utils/type_checkers.nut @@ -8,6 +8,19 @@ ::MSU.requireTypeArray("integer", vargv); } +::MSU.requireUnsigned <- function( ... ) +{ + ::MSU.requireInt(vargv); + foreach (value in vargv) + { + if (value < 0) + { + ::logError(value + " must have the type: unsigned"); + throw ::MSU.Exception.InvalidType(value); + } + } +} + ::MSU.requireArray <- function( ... ) { ::MSU.requireTypeArray("array", vargv);