mirror of
https://github.com/MikaylaFischler/cc-mek-scada.git
synced 2024-08-30 18:22:34 +00:00
param type change and added validator.assert
This commit is contained in:
parent
16258a2631
commit
32653c3b8a
@ -279,7 +279,7 @@ end
|
|||||||
|
|
||||||
-- check if a color is a valid single color
|
-- check if a color is a valid single color
|
||||||
---@nodiscard
|
---@nodiscard
|
||||||
---@param color integer
|
---@param color any
|
||||||
---@return boolean valid
|
---@return boolean valid
|
||||||
function rsio.is_color(color)
|
function rsio.is_color(color)
|
||||||
return util.is_int(color) and (color > 0) and (_B_AND(color, (color - 1)) == 0)
|
return util.is_int(color) and (color > 0) and (_B_AND(color, (color - 1)) == 0)
|
||||||
|
@ -18,7 +18,7 @@ local type = type
|
|||||||
local util = {}
|
local util = {}
|
||||||
|
|
||||||
-- scada-common version
|
-- scada-common version
|
||||||
util.version = "1.1.7"
|
util.version = "1.1.8"
|
||||||
|
|
||||||
util.TICK_TIME_S = 0.05
|
util.TICK_TIME_S = 0.05
|
||||||
util.TICK_TIME_MS = 50
|
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_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_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_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(check, min) valid = valid and check >= min end
|
||||||
function public.assert_min_ex(check, min) valid = valid and check > min end
|
function public.assert_min_ex(check, min) valid = valid and check > min end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user