Class TextGauge

Creates a text based gauge, for use in miniconsoles and the like.

Info:

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

Methods

TextGauge:new([options]) Creates a new TextGauge.
TextGauge:setWidth(width) Sets the width in characters of the gauge
TextGauge:setFillCharacter(character) Sets the character to use for the 'full' part of the gauge
TextGauge:setEmptyCharacter(character) Sets the character to use for the 'full' part of the gauge
TextGauge:setFillColor(color) Sets the fill color for the gauge.
TextGauge:setEmptyColor(color) Sets the empty color for the gauge.
TextGauge:setPercentColor(color) Sets the fill color for the gauge.
TextGauge:setPercentSymbolColor(color) Sets the fill color for the gauge.
TextGauge:enableShowPercent() Enables showing the percent value of the gauge
TextGauge:disableShowPercent() Disables showing the percent value of the gauge
TextGauge:enableShowPercentSymbol() Enables showing the percent symbol (appears after the value)
TextGauge:disableShowPercentSymbol() Enables showing the percent symbol (appears after the value)
TextGauge:setValue([current[, max]]) Used to set the gauge's value and return the string representation of the gauge
TextGauge:print(...) Synonym for setValue


Methods

TextGauge:new([options])
Creates a new TextGauge. Please see the wiki for more information on valid options.

Parameters:

  • options table The table of options you would like the TextGauge to start with.

    Table of new options
    option name description default
    width How many characters wide to make the gauge 24
    fillCharacter What character to use for the 'full' part of the gauge :
    emptyCharacter What character to use for the 'empty' part of the gauge -
    showPercent Should we show what % of the gauge is filled? true
    showPercentSymbol Should we show the % sign itself? true
    format What type of color formatting to use? 'c' for cecho, 'd' for decho, 'h' for hecho c
    value How much of the gauge should be filled 50
    (optional)
TextGauge:setWidth(width)
Sets the width in characters of the gauge

Parameters:

  • width number number of characters wide to make the gauge
TextGauge:setFillCharacter(character)
Sets the character to use for the 'full' part of the gauge

Parameters:

  • character string the character to use.
TextGauge:setEmptyCharacter(character)
Sets the character to use for the 'full' part of the gauge

Parameters:

  • character string the character to use.
TextGauge:setFillColor(color)
Sets the fill color for the gauge.

Parameters:

  • color string the color to use for the full portion of the gauge. Will be run through Geyser.Golor
TextGauge:setEmptyColor(color)
Sets the empty color for the gauge.

Parameters:

  • color string the color to use for the empty portion of the gauge. Will be run through Geyser.Golor
TextGauge:setPercentColor(color)
Sets the fill color for the gauge.

Parameters:

  • color string the color to use for the numeric value. Will be run through Geyser.Golor
TextGauge:setPercentSymbolColor(color)
Sets the fill color for the gauge.

Parameters:

  • color string the color to use for the numeric value. Will be run through Geyser.Golor
TextGauge:enableShowPercent()
Enables showing the percent value of the gauge
TextGauge:disableShowPercent()
Disables showing the percent value of the gauge
TextGauge:enableShowPercentSymbol()
Enables showing the percent symbol (appears after the value)
TextGauge:disableShowPercentSymbol()
Enables showing the percent symbol (appears after the value)
TextGauge:setValue([current[, max]])
Used to set the gauge's value and return the string representation of the gauge

Parameters:

  • current number current value. If no value is passed it will use the stored value. Defaults to 50 to prevent errors. (optional)
  • max number maximum value. If not passed, the internally stored one will be used. Defaults to 100 so that it can be used with single values as a percent (optional)

Usage:

  • myGauge:setValue(55) -- sets the gauge to 55% full
  • myGauge:setValue(2345, 2780) -- will figure out what the percentage fill is based on the given current/max values
TextGauge:print(...)
Synonym for setValue

Parameters:

  • ...
generated by LDoc 1.4.6 Last updated 2020-08-25 15:14:20