From 32653c3b8a184e2d45afda1d8a607eac367e563f Mon Sep 17 00:00:00 2001 From: Mikayla Fischler Date: Sun, 5 Nov 2023 13:23:22 -0500 Subject: [PATCH] param type change and added validator.assert --- scada-common/rsio.lua | 2 +- scada-common/util.lua | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/scada-common/rsio.lua b/scada-common/rsio.lua index 92ee280..c3294cb 100644 --- a/scada-common/rsio.lua +++ b/scada-common/rsio.lua @@ -279,7 +279,7 @@ end -- check if a color is a valid single color ---@nodiscard ----@param color integer +---@param color any ---@return boolean valid function rsio.is_color(color) return util.is_int(color) and (color > 0) and (_B_AND(color, (color - 1)) == 0) diff --git a/scada-common/util.lua b/scada-common/util.lua index 1ab8cd7..3623583 100644 --- a/scada-common/util.lua +++ b/scada-common/util.lua @@ -18,7 +18,7 @@ local type = type local util = {} -- scada-common version -util.version = "1.1.7" +util.version = "1.1.8" util.TICK_TIME_S = 0.05 util.TICK_TIME_MS = 50 @@ -482,6 +482,7 @@ function util.new_validator() function public.assert_type_str(value) valid = valid and type(value) == "string" end function public.assert_type_table(value) valid = valid and type(value) == "table" end + function public.assert(check) valid = valid and (check == true) end function public.assert_eq(check, expect) valid = valid and check == expect end function public.assert_min(check, min) valid = valid and check >= min end function public.assert_min_ex(check, min) valid = valid and check > min end