Class TextFormatter
Stand alone text formatter object.
Remembers the options you set and can be adjusted as needed
Methods
TextFormatter:setType(typeToSet) | Set's the formatting type whether it's for cecho, decho, or hecho |
TextFormatter:setWrap(shouldWrap) | Sets whether or not we should do word wrapping. |
TextFormatter:setWidth(width) | Sets the width we should format for |
TextFormatter:setCap(cap) | Sets the cap for the formatter |
TextFormatter:setCapColor(capColor) | Sets the color for the format cap |
TextFormatter:setSpacerColor(spacerColor) | Sets the color for spacing character |
TextFormatter:setTextColor(textColor) | Sets the color for formatted text |
TextFormatter:setSpacer(spacer) | Sets the spacing character to use. |
TextFormatter:setAlignment(alignment) | Set the alignment to format for |
TextFormatter:setInside(spacerInside) | Set whether the the spacer should go inside the the cap or outside of it |
TextFormatter:setMirror(shouldMirror) | Set whether we should mirror/reverse the caps. |
TextFormatter:format(str) | Format a string based on the stored options |
TextFormatter:new(options) | Creates and returns a new TextFormatter. |
Methods
- TextFormatter:setType(typeToSet)
-
Set's the formatting type whether it's for cecho, decho, or hecho
Parameters:
- typeToSet string What type of formatter is this? Valid options are { 'd', 'dec', 'decimal', 'h', 'hex', 'hexidecimal', 'c', 'color', 'colour', 'col', 'name'}
- TextFormatter:setWrap(shouldWrap)
-
Sets whether or not we should do word wrapping.
Parameters:
- shouldWrap boolean should we do wordwrapping?
- TextFormatter:setWidth(width)
-
Sets the width we should format for
Parameters:
- width number the width we should format for
- TextFormatter:setCap(cap)
-
Sets the cap for the formatter
Parameters:
- cap string the string to use for capping the formatted string.
- TextFormatter:setCapColor(capColor)
-
Sets the color for the format cap
Parameters:
- capColor string Color which can be formatted via Geyser.Color.parse()
- TextFormatter:setSpacerColor(spacerColor)
-
Sets the color for spacing character
Parameters:
- spacerColor string Color which can be formatted via Geyser.Color.parse()
- TextFormatter:setTextColor(textColor)
-
Sets the color for formatted text
Parameters:
- textColor string Color which can be formatted via Geyser.Color.parse()
- TextFormatter:setSpacer(spacer)
-
Sets the spacing character to use. Should be a single character
Parameters:
- spacer string the character to use for spacing
- TextFormatter:setAlignment(alignment)
-
Set the alignment to format for
Parameters:
- alignment string How to align the formatted string. Valid options are 'left', 'right', or 'center'
- TextFormatter:setInside(spacerInside)
-
Set whether the the spacer should go inside the the cap or outside of it
Parameters:
- spacerInside boolean
- TextFormatter:setMirror(shouldMirror)
-
Set whether we should mirror/reverse the caps. IE << becomes >> if set to true
Parameters:
- shouldMirror boolean
- TextFormatter:format(str)
-
Format a string based on the stored options
Parameters:
- str string The string to format
- TextFormatter:new(options)
-
Creates and returns a new TextFormatter. For valid options, please see https://github.com/demonnic/fText/wiki/fText
Parameters:
- options table the options for the text formatter to use when running format()