Validator
Thevalidator module creates small schema objects that expose parse(data). A successful parse returns true. A failed parse raises Validation Error: ..., so wrap user-controlled inputs with pcall when you want to handle errors without stopping execution.
Basic schema
Rules
function
Marks a value as required. When
message is provided, that message overrides the default missing-field error.function
Sets a custom error message for the rule. The message is used when type or custom checks fail.
function
Requires a numeric value to be greater than or equal to
value.function
Requires a numeric value to be less than or equal to
value.function
Applies both
min(min) and max(max).function
Requires the parsed value to equal one entry in the given array.
