Class TableMaker

Easy formatting for text tables

Info:

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

Methods

TableMaker:addColumn(options, position) Adds a column definition for the table.
TableMaker:deleteColumn(position) Deletes a column at the given position
TableMaker:replaceColumn(options, position) Replaces a column at a specific position with the newly provided formatting
TableMaker:addRow(columnEntries, position) Adds a row of output to the table
TableMaker:deleteRow(position) Deletes the row at the given position
TableMaker:replaceRow(columnEntries, position) Replaces a row of output in the table
TableMaker:setCell(row, column, entry) Sets a specific cell's display information
TableMaker:enablePopups() enables making cells which incorporate insertLink/insertPopup
TableMaker:enableAutoEcho() enables autoEcho so that when assemble is called it echos automatically
TableMaker:disableAutoEcho() disables autoecho.
TableMaker:enableAutoClear() Enables automatically clearing the miniconsole we echo to
TableMaker:disableAutoClear() Disables automatically clearing the miniconsole we echo to
TableMaker:setAutoEchoConsole(console) Set the miniconsole to echo to
TableMaker:assemble() Assemble the table.
TableMaker:new(options) Creates and returns a new TableMaker.


Methods

TableMaker:addColumn(options, position)
Adds a column definition for the table.

Parameters:

  • options table Table of options suitable for a TextFormatter object. See https://github.com/demonnic/fText/wiki/fText
  • position number The position of the column you're adding, counting from the left. If not provided will add it as the last column
TableMaker:deleteColumn(position)
Deletes a column at the given position

Parameters:

  • position number the column you wish to delete
TableMaker:replaceColumn(options, position)
Replaces a column at a specific position with the newly provided formatting

Parameters:

  • options table table of options suitable for a TextFormatter object. See https://github.com/demonnic/fText/wiki/fText
  • position number which column you are replacing, counting from the left.
TableMaker:addRow(columnEntries, position)
Adds a row of output to the table

Parameters:

  • columnEntries table This indexed table contains an entry for each column in the table. Entries in the table must be strings, a table of options for insertPopup or insertLink, or a function which returns one of these things
  • position number position for the row you want to add, counting from the top down. If not provided defaults to the last line in the table.
TableMaker:deleteRow(position)
Deletes the row at the given position

Parameters:

  • position number the row to delete
TableMaker:replaceRow(columnEntries, position)
Replaces a row of output in the table

Parameters:

  • columnEntries table This indexed table contains an entry for each column in the table. Entries in the table must be strings, a table of options for insertPopup or insertLink, or a function which returns one of these things
  • position number position for the row you want to add, counting from the top down.
TableMaker:setCell(row, column, entry)
Sets a specific cell's display information

Parameters:

  • row number the row number of the cell, counted from the top down
  • column number the column number of the cell, counted from the left
  • entry What to set the entry to. Must be a string, or a table of options for insertLink/insertPopup if allowPopups is set. Or a function which returns one of these things
TableMaker:enablePopups()
enables making cells which incorporate insertLink/insertPopup
TableMaker:enableAutoEcho()
enables autoEcho so that when assemble is called it echos automatically
TableMaker:disableAutoEcho()
disables autoecho. Cannot be used if allowPopups is set
TableMaker:enableAutoClear()
Enables automatically clearing the miniconsole we echo to
TableMaker:disableAutoClear()
Disables automatically clearing the miniconsole we echo to
TableMaker:setAutoEchoConsole(console)
Set the miniconsole to echo to

Parameters:

  • console The miniconsole to autoecho to. Set to "main" or do not pass the parameter to autoecho to the main console. Can be a string name of the console, or a Geyser MiniConsole
TableMaker:assemble()
Assemble the table. If autoEcho is enabled/set to true, will automatically echo. Otherwise, returns the formatted string to echo the table
TableMaker:new(options)
Creates and returns a new TableMaker. See https://github.com/demonnic/fText/wiki/TableMaker for valid entries to the options table.

Parameters:

  • options table table of options for the TableMaker object

    Table of new options
    option name description default
    formatType Determines how it formats for color. 'c' for cecho, 'd' for decho, 'h' for hecho, and anything else for no colors c
    printHeaders print top row as header true
    headCharacter The character used to construct the very top of the table. A solid line of these characters is used "*"
    footCharacter The character used to construct the very bottom of the table. A solid line of these characters is used "*"
    edgeCharacter the character used to form the left and right edges of the table. There is one on either side of every line "*"
    frameColor The color to use for the frame. The frame is the border around the outside edge of the table (headCharacter, footCharacter, and edgeCharacters will all be this color). the correct 'white' for your formatType
    rowSeparator the character used to form the lines between rows of text "-"
    separator Character used between columns. "|"
    separatorColor the color used for the separators, the things which divide the rows and columns internally. (separator and rowSeparator will be this color) frameColor
    autoEcho echo the table automatically in addition to returning the string representation? false
    autoEchoConsole MiniConsole to autoEcho to "main"
    autoClear If autoEchoing, and not echoing to the main console, should we clear the console before outputting? false
    allowPopups setting this to true allows you to make cells in the table clickable, as well as give them right-click menus.
    Please see Clickable Tables HERE
    false
generated by LDoc 1.4.6 Last updated 2020-08-25 15:14:20