Class fort

Fort Module

Functions

fort.new () Alias of fort.create_table
fort.create_table () Create a new formatted table
fort.set_default_border_style (style) Set the default border style for new tables.
fort.set_default_cell_prop (property, value) Set a default cell property for new tables.
fort.set_default_tbl_prop (property, value) Set a default table property for new tables.

Fields

fort.default_separator Control the default separator for printf and printf_ln functions.

Metamethods

fort.__call Alias of fort.create_table

Methods

fort:printf (row_format, ...) Use a formatted string to write a row.
fort:printf_ln (row_format, ...) Use a formatted string to write a row and go to the next line.
fort:print (row_text[, sep=fort.default_separator]) Write a row.
fort:print_ln (row_text[, sep=fort.default_separator]) Write a row and go to the next line.
fort:table_write (data_table[, colalign=false]) Write a 2d array of strings to the ftable.
fort:table_write_ln (data_table[, colalign=false]) Write a 2d array of strings to the ftable and go to next line.
fort:add_separator () Add a dividing separtor line at the current row.
fort:copy_table () Completely Copy a table
fort:copy () Alias of fort.copy_table
fort:cur_col () Get the current column
fort:cur_row () Get the current row
fort:erase_range (top_left_row, top_left_col, bottom_right_row, bottom_right_col) Erase a rectangular range of data from the ftable
fort:is_empty () Check if ftable is empty
fort:ln () Go to the next line (row)
fort:row_count () Get the number of rows in the ftable
fort:row_write (row) Write a row of data.
fort:row_write_ln (row) Write a row of data and go to the next line.
fort:write (...) Write a row
fort:write_ln (...) Write a row and go to the next line
fort:set_border_style (style) Set the border style of the ftable.
fort:set_cell_prop (row, col, property, value) Set the cell property of the ftable.
fort:set_cell_span (row, col, span) Set a cell’s horizontal span in the ftable.
fort:set_cur_cell (row, col) Set the current cell position.
fort:set_tbl_prop (property, value) Set a table property.
fort:to_string () Generate the string version of the ftable.

Cell Text Align

fort.ALIGNED_CENTER align text center
fort.ALIGNED_LEFT align text left
fort.ALIGNED_RIGHT align text right

Cell Selectors

fort.ANY_COLUMN Select all columns
fort.ANY_ROW Select all rows
fort.CUR_COLUMN Select the current column
fort.CUR_ROW Select the current row

Table Border Style

fort.BASIC_STYLE Border style
fort.BASIC2_STYLE Border style
fort.BOLD_STYLE Border style
fort.BOLD2_STYLE Border style
fort.DOT_STYLE Border style
fort.DOUBLE_STYLE Border style
fort.DOUBLE2_STYLE Border style
fort.EMPTY_STYLE Border style
fort.EMPTY2_STYLE Border style
fort.FRAME_STYLE Border style
fort.NICE_STYLE Border style
fort.PLAIN_STYLE Border style
fort.SIMPLE_STYLE Border style
fort.SOLID_ROUND_STYLE Border style
fort.SOLID_STYLE Border style

Cell Color

fort.COLOR_BLACK Color
fort.COLOR_BLUE Color
fort.COLOR_CYAN Color
fort.COLOR_DARK_GRAY Color
fort.COLOR_DEFAULT Color
fort.COLOR_GREEN Color
fort.COLOR_LIGHT_BLUE Color
fort.COLOR_LIGHT_CYAN Color
fort.COLOR_LIGHT_GRAY Color
fort.COLOR_LIGHT_GREEN Color
fort.COLOR_LIGHT_MAGENTA Color
fort.COLOR_LIGHT_RED Color
fort.COLOR_LIGHT_WHITE Color
fort.COLOR_LIGHT_YELLOW Color
fort.COLOR_MAGENTA Color
fort.COLOR_RED Color
fort.COLOR_YELLOW Color

Cell Property

fort.CPROP_CELL_BG_COLOR Cell Property
fort.CPROP_CELL_TEXT_STYLE Cell Property
fort.CPROP_CONT_BG_COLOR Cell Property
fort.CPROP_CONT_FG_COLOR Cell Property
fort.CPROP_CONT_TEXT_STYLE Cell Property
fort.CPROP_EMPTY_STR_HEIGHT Cell Property
fort.CPROP_MIN_WIDTH Cell Property
fort.CPROP_ROW_TYPE Cell Property
fort.CPROP_TEXT_ALIGN Cell Property
fort.CPROP_TOP_PADDING Cell Property
fort.CPROP_LEFT_PADDING Cell Property
fort.CPROP_BOTTOM_PADDING Cell Property
fort.CPROP_RIGHT_PADDING Cell Property

Row Type

fort.ROW_COMMON Row Type
fort.ROW_HEADER Row Type

Table Adding Strategy

fort.STRATEGY_INSERT Insert new cells
fort.STRATEGY_REPLACE Replace current cells

Table Property

fort.TPROP_ADDING_STRATEGY Table Property
fort.TPROP_BOTTOM_MARGIN Table Property
fort.TPROP_LEFT_MARGIN Table Property
fort.TPROP_RIGHT_MARGIN Table Property
fort.TPROP_TOP_MARGIN Table Property

Cell Text Style

fort.TSTYLE_BLINK Text Style
fort.TSTYLE_BOLD Text Style
fort.TSTYLE_DEFAULT Text Style
fort.TSTYLE_DIM Text Style
fort.TSTYLE_HIDDEN Text Style
fort.TSTYLE_INVERTED Text Style
fort.TSTYLE_ITALIC Text Style
fort.TSTYLE_UNDERLINED Text Style


Functions

Methods
fort.new ()
Alias of fort.create_table
fort.create_table ()
Create a new formatted table

Returns:

    ftable new formatted table
fort.set_default_border_style (style)
Set the default border style for new tables.

Parameters:

fort.set_default_cell_prop (property, value)
Set a default cell property for new tables.

Parameters:

  • property number the property to set
  • value number value to set
fort.set_default_tbl_prop (property, value)
Set a default table property for new tables.

Parameters:

  • property number the property to set
  • value number value to set

Fields

fort.default_separator
Control the default separator for printf and printf_ln functions. (Defaults to ‘|’)

Metamethods

fort.__call
Alias of fort.create_table

Methods

fort:printf (row_format, ...)
Use a formatted string to write a row.

Splits cells on fort.default_separator. Uses lua string.format to format the text.

Parameters:

  • row_format string row to write with formatting
  • ... any format arguments
fort:printf_ln (row_format, ...)
Use a formatted string to write a row and go to the next line.

Splits cells on fort.default_separator. Uses lua string.format to format the text.

Parameters:

  • row_format string row to write with formatting
  • ... any format arguments
fort:print (row_text[, sep=fort.default_separator])
Write a row. Use a single string to write a row. Allows using a custom cell separator without modifying the global separator.

Parameters:

  • row_text string
  • sep string cell separator (default fort.default_separator)
fort:print_ln (row_text[, sep=fort.default_separator])
Write a row and go to the next line. Use a single string to write a row. Allows using a custom cell separator without modifying the global separator.

Parameters:

  • row_text string
  • sep string cell separator (default fort.default_separator)
fort:table_write (data_table[, colalign=false])
Write a 2d array of strings to the ftable.

Parameters:

  • data_table {{string}} 2d array of strings to write, can be jagged.
  • colalign bool align to the cur_col at the start (default false)
fort:table_write_ln (data_table[, colalign=false])
Write a 2d array of strings to the ftable and go to next line.

Parameters:

  • data_table {{string}} 2d array of strings to write, can be jagged.
  • colalign bool align to the cur_col at the start (default false)
fort:add_separator ()
Add a dividing separtor line at the current row.
fort:copy_table ()
Completely Copy a table

Returns:

    ftable copied table
fort:copy ()
Alias of fort.copy_table

Returns:

    ftable copied table
fort:cur_col ()
Get the current column

Returns:

    number
fort:cur_row ()
Get the current row

Returns:

    number
fort:erase_range (top_left_row, top_left_col, bottom_right_row, bottom_right_col)
Erase a rectangular range of data from the ftable

Parameters:

  • top_left_row number
  • top_left_col number
  • bottom_right_row number
  • bottom_right_col number
fort:is_empty ()
Check if ftable is empty

Returns:

    boolean
fort:ln ()
Go to the next line (row)
fort:row_count ()
Get the number of rows in the ftable

Returns:

    number
fort:row_write (row)
Write a row of data.

Parameters:

fort:row_write_ln (row)
Write a row of data and go to the next line.

Parameters:

fort:write (...)
Write a row

Parameters:

  • ... string strings to write in the row
fort:write_ln (...)
Write a row and go to the next line

Parameters:

  • ... string strings to write in the row
fort:set_border_style (style)
Set the border style of the ftable.

Parameters:

fort:set_cell_prop (row, col, property, value)
Set the cell property of the ftable.

Parameters:

  • row number the row to set, can also use ANY_ROW/CUR_ROW
  • col number the column to set, can also use ANY_COLUMN/CUR_COLUMN
  • property number the property to set
  • value number value to set
fort:set_cell_span (row, col, span)
Set a cell’s horizontal span in the ftable.

Parameters:

fort:set_cur_cell (row, col)
Set the current cell position.

Parameters:

fort:set_tbl_prop (property, value)
Set a table property.

Parameters:

  • property number the property to set
  • value number value to set
fort:to_string ()
Generate the string version of the ftable.

Returns:

    string formatted table string

Cell Text Align

Indicate the text alignment inside a cell.

Can be used with set_cell_prop/set_default_cell_prop

fort.ALIGNED_CENTER
align text center
fort.ALIGNED_LEFT
align text left
fort.ALIGNED_RIGHT
align text right

Cell Selectors

Special flags that select a cell

Can be used with set_cell_prop

fort.ANY_COLUMN
Select all columns
fort.ANY_ROW
Select all rows
fort.CUR_COLUMN
Select the current column
fort.CUR_ROW
Select the current row

Table Border Style

Border styling of the table.

Refer to refer to this page to see how each border style looks.

fort.BASIC_STYLE
Border style
fort.BASIC2_STYLE
Border style
fort.BOLD_STYLE
Border style
fort.BOLD2_STYLE
Border style
fort.DOT_STYLE
Border style
fort.DOUBLE_STYLE
Border style
fort.DOUBLE2_STYLE
Border style
fort.EMPTY_STYLE
Border style
fort.EMPTY2_STYLE
Border style
fort.FRAME_STYLE
Border style
fort.NICE_STYLE
Border style
fort.PLAIN_STYLE
Border style
fort.SIMPLE_STYLE
Border style
fort.SOLID_ROUND_STYLE
Border style
fort.SOLID_STYLE
Border style

Cell Color

Color used for cell/content properties.
fort.COLOR_BLACK
Color
fort.COLOR_BLUE
Color
fort.COLOR_CYAN
Color
fort.COLOR_DARK_GRAY
Color
fort.COLOR_DEFAULT
Color
fort.COLOR_GREEN
Color
fort.COLOR_LIGHT_BLUE
Color
fort.COLOR_LIGHT_CYAN
Color
fort.COLOR_LIGHT_GRAY
Color
fort.COLOR_LIGHT_GREEN
Color
fort.COLOR_LIGHT_MAGENTA
Color
fort.COLOR_LIGHT_RED
Color
fort.COLOR_LIGHT_WHITE
Color
fort.COLOR_LIGHT_YELLOW
Color
fort.COLOR_MAGENTA
Color
fort.COLOR_RED
Color
fort.COLOR_YELLOW
Color

Cell Property

fort.CPROP_CELL_BG_COLOR
Cell Property
fort.CPROP_CELL_TEXT_STYLE
Cell Property
fort.CPROP_CONT_BG_COLOR
Cell Property
fort.CPROP_CONT_FG_COLOR
Cell Property
fort.CPROP_CONT_TEXT_STYLE
Cell Property
fort.CPROP_EMPTY_STR_HEIGHT
Cell Property
fort.CPROP_MIN_WIDTH
Cell Property
fort.CPROP_ROW_TYPE
Cell Property
fort.CPROP_TEXT_ALIGN
Cell Property
fort.CPROP_TOP_PADDING
Cell Property
fort.CPROP_LEFT_PADDING
Cell Property
fort.CPROP_BOTTOM_PADDING
Cell Property
fort.CPROP_RIGHT_PADDING
Cell Property

Row Type

fort.ROW_COMMON
Row Type
fort.ROW_HEADER
Row Type

Table Adding Strategy

fort.STRATEGY_INSERT
Insert new cells
fort.STRATEGY_REPLACE
Replace current cells

Table Property

fort.TPROP_ADDING_STRATEGY
Table Property
fort.TPROP_BOTTOM_MARGIN
Table Property
fort.TPROP_LEFT_MARGIN
Table Property
fort.TPROP_RIGHT_MARGIN
Table Property
fort.TPROP_TOP_MARGIN
Table Property

Cell Text Style

fort.TSTYLE_BLINK
Text Style
fort.TSTYLE_BOLD
Text Style
fort.TSTYLE_DEFAULT
Text Style
fort.TSTYLE_DIM
Text Style
fort.TSTYLE_HIDDEN
Text Style
fort.TSTYLE_INVERTED
Text Style
fort.TSTYLE_ITALIC
Text Style
fort.TSTYLE_UNDERLINED
Text Style
generated by LDoc 1.4.6