param type change and added validator.assert

This commit is contained in:
Mikayla Fischler 2023-11-05 13:23:22 -05:00
parent 16258a2631
commit 32653c3b8a
2 changed files with 3 additions and 2 deletions

View File

@ -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)

View File

@ -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