Module StatsTable

This Module creates a table for stats of a tournament.

Functions

printHeader (name, icon) Create the header row Creates the header row html node
printTable (name, icon, rows) Create the rest of the table.
printRow (htmlTable, icon, row) Create a single html table row.
printCombinedRow (htmlTable, row) Create the combined row.
p.main (frame) The entry point of the Module.
getRows (args) Divides arguments to a table.
calcPerStats (rows) Calculates the per game per player stats using the table data.
calcMaximas (rows) Calculate the maximum number in each row.
fixRow (row) Fix the formatting of some rows.
formatDec (num, len) Formats a decimal to have a specific number of decimal places.
fixOrder (row) Reorders cells in a row.
calcCombinedStats (rows) Calculates the combined stats of the whole table.
protectedExpansion (frame, title, args) Safely expands a template.
expandTemplate (frame, title, args) Expands a template.


Functions

printHeader (name, icon)
Create the header row Creates the header row html node

Parameters:

  • name string - the name of the tournament
  • icon string - the icon of the tournament (in html code)

Returns:

    a node - html table node
printTable (name, icon, rows)
Create the rest of the table. Creates all the html table rows nodes except the header and the combined rows.

Parameters:

  • name string - the name of the tournament
  • icon string - the icon in the header and each row (in html code)
  • rows table - the rows of the table

Returns:

    a string - expanded html div that includes the html table
printRow (htmlTable, icon, row)
Create a single html table row. Creates a single html table row to the provided html table node.

Parameters:

  • htmlTable node - the html table node to insert the html table row to
  • icon string - the icon of the row (in html code)
  • row table

Returns:

    nil
printCombinedRow (htmlTable, row)
Create the combined row. Creates the combined row which adds up the points in each column.

Parameters:

  • htmlTable node - the html node to add the table row to
  • row table - the row to add to the table

Returns:

    nil
p.main (frame)
The entry point of the Module. The entry point of the Module.

Parameters:

  • frame frame

Returns:

    string html code constructing the table
getRows (args)
Divides arguments to a table. Divides arguments into a table of rows, each row is a table of data that's required to construct the html node of this row.

Parameters:

  • args table - the arguments provided to the template

Returns:

    table - the divided rows
calcPerStats (rows)
Calculates the per game per player stats using the table data. Calculates the per game per player stats using the table data.

Parameters:

  • rows table - the table which has the rows' data return table - the table after adding the per player per game stats to it
calcMaximas (rows)
Calculate the maximum number in each row. Calculate the maximum number in each row.

Parameters:

  • rows table - the table which has the rows' data

Returns:

    nil
fixRow (row)
Fix the formatting of some rows. Fix the formatting of some rows. Formats some of the rows

Parameters:

  • row table - the row to fix the formatting of

Returns:

    nil
formatDec (num, len)
Formats a decimal to have a specific number of decimal places. Formats a decimal to have a specific number of decimal places.

Parameters:

  • num number - the number to format
  • len number - the number of decimal places

Returns:

    string - the formatted number in a string container
fixOrder (row)
Reorders cells in a row. Reorders cells in a row.

Parameters:

  • row table - the row to reorder

Returns:

    nil
calcCombinedStats (rows)
Calculates the combined stats of the whole table. Calculates the combined stats of the whole table.

Parameters:

  • rows table

Returns:

    a table - the table with the combined stats row added
protectedExpansion (frame, title, args)
Safely expands a template. Expands a template while making sure a missing template doesn't stop the code execution.

Parameters:

  • frame frame
  • title string
  • args table

Returns:

    a string value - the expansion if exists, else error message
expandTemplate (frame, title, args)
Expands a template. Expands a template using a frame and returns the result of the expansion.

Parameters:

  • frame frame
  • title string
  • args table

Returns:

    a string value - the expanded template
generated by LDoc 1.4.6 Last updated 2020-07-19 07:49:31