Type constructors - Manhunter07/MFL GitHub Wiki
Type constructors are comparable to generic types (or type templates) in C++, C# and Delphi. They are however, pre-defined language constructs that have a slightly special syntax. Not to be mistaken for declared constructors for types.
any([Type1[, ...]])
Specifies a type that accepts any of the argument types. Accepts only type identifiers as arguments.
any(Type1[, Type2[, ...]])
Specifies a type that accepts none of the argument types. Accepts only type identifiers as arguments. If no parameters are set, the resulting type accepts any value.
range(MinValue, MaxValue)
range(MaxValue, MinValue)
Specifies a type that supports a value range of two values passed as constraints. Accepts two values as arguments. If the first argument is greater than the second argument, it is set for the second parameter, thus you can be asured the constraints are normalized.
enum(Value1[, Value2[, ...]])
Specifies a type that supports a selection of one or more values. Accepts one or more values as arguments.
integer([Divisor1 = 1[, Divisor 2[, ...]]])
Specifies a type that supports numbers that are integer-dividable by a selection of divisors. Accepts only numbers as as arguments. If no parameters are set, the resulting type accepts any integer number.
rangeint(MinValue, MaxValue[, Divisor1 = 1[, Divisor2[, ...]]])
Specifies a type that supports a range of two numbers passed as constraints that are integer-dividable by a selection of divisors. Accepts two or more numbers as as arguments. If no divisors are set, the resulting type accepts any integer number within the range.
sizeint(Signed, Size[, Divisor1 = 1[, Divisor2[, ...]]])
Specifies a type that supports a positive or mixed range of numbers supported by the byte-size passed as argument. Accepts one boolean and one or more numbers as as arguments. If no divisors are set, the resulting type accepts any integer number representable within the byte count. If the first parameter is set True, the value range is treated 2-complementary.
string([Length])
string([MinLength, MaxLength])
Specifies a type that supports a strings with either any, a fixed or a ranged length. Accepts zero, one or two integer numbers as as arguments. If no length is set, any string value passes the type check. If a fixed length (first overload) is set, the resulting type accepts only strings with exactly Length characters. If both the minimum and maximum lengths (second overload) are set, the resulting type accepts any strings with at least MinLength and at most MaxLength characters.
array([DimensionSize1[[: DimensionType1], ...]])
Specifies a type that supports a arrays with zero, one or more dimensions. Accepts any amount of integer numbers and optional type constraints as arguments. If no dimensions are set, the resulting type accepts any array value. If a dimension specifies no type constraint, the resulting type accepts any type within the dimension. A n-th array dimension is the length and/or type of a nested array within an existing array.
record([FieldName1[[: FieldType1], ...]])
object(ParentType1[, ...])
custom(AssertFunction1[, ...])