Module CompilerPropertyFilter
Module for compile-time filter related methods.
Info:
- License: MIT
- Author: Richard Voelker
Functions
UDim2Filter (value) | Return a UDim2 LiteralString from an input string. |
Vector2Filter (value) | Return a Vector2 LiteralString from an input string. |
Vector3Filter (value) | Return a Vector3 LiteralString from an input string. |
PositionAndSizeFilter (className, value) | Parses a string for a Position or Size parameter. |
BrickColorFilter (className, value) | Return a BrickColor LiteralString from an input string. |
Color3Filter (className, value) | Return a Color3 LiteralString from an input string. |
EnumFilter (enum) | Return a function for a Enum LiteralString filter from an input string. |
StyleEnumFilter (className, value) | A specific enum filter for the 'Style' enum type. |
FilterProperty (className, propertyName, propertyValue) | Filter a property if there is a filter available, or output the property as-is. |
Functions
- UDim2Filter (value)
-
Return a UDim2 LiteralString from an input string. If the
string has 2 numbers separated by a comma, then these are
assumed to be the X and Y offsets. If there are 4 numbers
separated by a comma, these are assumed to be all 4
arguments to the UDim2 constructor. Otherwise, the string is
returned as-is (assumed to be Lua code constructing the
UDim2).
Parameters:
- value string The input string to parse.
Returns:
-
LiteralString
The LiteralString with a UDim2
constructor contained within.
- Vector2Filter (value)
-
Return a Vector2 LiteralString from an input string. If the
string has 2 numbers separated by a comma, then these are
assumed to be the X and Y parameters. Otherwise, the string
is returned as-is (assumed to be Lua code constructing the
Vector2).
Parameters:
- value string The input string to parse.
Returns:
-
LiteralString
The LiteralString with a Vector2
constructor contained within.
- Vector3Filter (value)
-
Return a Vector3 LiteralString from an input string. If the
string has 1 number separated, then this number is used for
the X, Y, and Z parameters. If there are 3 numbers separated
by a comma, these are assumed to be the X, Y, and Z
parameters. Otherwise, the string is returned as-is (assumed
to be Lua code constructing the Vector3).
Parameters:
- value string The input string to parse.
Returns:
-
LiteralString
The LiteralString with a Vector3
constructor contained within.
- PositionAndSizeFilter (className, value)
-
Parses a string for a Position or Size parameter. If the
class is a Gui class, then the UDim2Filter is used.
Otherwise the Vector3Filter is used.
Parameters:
Returns:
-
LiteralString
The LiteralString with a UDim2 or
Vector3 constructor contained within.
- BrickColorFilter (className, value)
-
Return a BrickColor LiteralString from an input string. If
string has 1 number, this is assumed to be a
BrickColor code.
If there are 3 numbers separated by a comma, these are
assumed to be the R, G, and B values, in the range of
[0, 255]. If there is a name, this is assumed to be a
BrickColor name.
Otherwise the string is returned as-is (assumed to be Lua
code with a BrickColor constructor).
Parameters:
Returns:
-
LiteralString
The LiteralString with a BrickColor
constructor contained within.
- Color3Filter (className, value)
-
Return a Color3 LiteralString from an input string. It has
the same rules as BrickColorFilter, except for returning
the string as-is; a Color3 constructor is assumed as input
in that case (instead of a BrickColor).
Parameters:
Returns:
-
LiteralString
The LiteralString with a Color3
constructor contained within.
- EnumFilter (enum)
-
Return a function for a Enum LiteralString filter from an
input string. The filter returned has the same parameters as
the BrickColorFilter & Color3Filter. If the input
string to the filter is a single enum name, the string is
returned as Enum.(enumType).(enumValue). Otherwise, the
string is returned as-is (assuming that the input was the
full enum value).
Parameters:
- enum string The name of the enum group.
Returns:
-
function
A filter functions with className and
value parameters which returns a LiteralString with an
Enum value contained within.
- StyleEnumFilter (className, value)
-
A specific enum filter for the 'Style' enum type. There are
4 different ROBLOX classes that use this enum.
Parameters:
Returns:
-
LiteralString
The LiteralString with a Enum
value contained within.
- FilterProperty (className, propertyName, propertyValue)
-
Filter a property if there is a filter available, or output
the property as-is.
Parameters: