Files
mysteriousisland/common/check.lua
T
2026-10-29 23:13:32 -06:00

22 lines
673 B
Lua

-- Private -----------------------------------------------------------------------------------------
local private = {}
function private.is_key(name, value, table_name, table_value)
if table_value[value] ~= nil then return end
error(name.." should be a key in "..table_name..", but "..value.." isn't present")
end
function private.is_type(name, value, type_name)
if type(value) == type_name then return end
error(name.." should be a "..type_name..", but was a "..type(value))
end
-- Export ------------------------------------------------------------------------------------------
return {
is_key = private.is_key,
is_type = private.is_type
}