Class TextFormatter

Stand alone text formatter object.

Remembers the options you set and can be adjusted as needed

Info:

  • Copyright: 2020 Damian Monogue
  • License: MIT, see LICENSE.lua
  • Author: Damian Monogue

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()

    Table of options
    option name description default
    wrap Should it wordwrap to multiple lines? true
    formatType Determines how it formats for color. 'c' for cecho, 'd' for decho, 'h' for hecho, and anything else for no colors "c"
    width How wide should we format the text? 80
    cap what characters to use for the endcap. ""
    capColor what color to make the endcap? the correct 'white' for your formatType
    spacer What character to use for empty space. Must be a single character " "
    spacerColor what color should the spacer be? the correct 'white' for your formatType
    textColor what color should the text itself be? the correct 'white' for your formatType
    alignment How should the text be aligned within the width. "center", "left", or "right" "center"
    nogap Should we put a literal space between the spacer character and the text? false
    inside Put the spacers inside the caps? false
    mirror Should the endcap be reversed on the right? IE [[ becomes ]] true
generated by LDoc 1.4.6 Last updated 2020-08-25 15:14:20