check_site_lib: add need_boolean check

This commit is contained in:
Matthias Schiffer 2014-07-16 16:31:31 +02:00
parent 851bbe699c
commit 442ef0bd36

View File

@ -47,6 +47,18 @@ function need_number(varname, required)
return var return var
end end
function need_boolean(varname, required)
local var = loadvar(varname)
if required == false and var == nil then
return nil
end
assert_type(var, 'boolean', "site.conf error: expected `" .. varname .. "' to be a boolean")
return var
end
function need_array(varname, subcheck, required) function need_array(varname, subcheck, required)
local var = loadvar(varname) local var = loadvar(varname)