Module:Data Table/Documentation

From Zelda Wiki, the Zelda encyclopedia
Jump to navigation Jump to search

This is the documentation page for Module:Data Table

This is the main module for the following templates:

In addition, this module exports the following functions.

Main

{{#invoke:Data Table|Main|game=|columns=|optionalColumns=}}

In addition to being the main invocation of Template:Data Table, this function can be used to create templates with fixed values for the parameters columns and/or game, e.g. Template:Goddess Cubes, Template:Gold Skulltulas, Template:Other Names, etc.

Parameters

ParameterStatusDescription
gameoptionalSee Template:Data Table
columnsoptionalSee Template:Data Table
optionalColumnsoptionalSee printTable

parseRows

parseRows(cells)

Allows other templates to use Template:Data Table's table-like syntax. Used by Module:Wares, for example.

Returns

  • A list of rows.

Examples

#InputOutput
1
parseRows({
  "-",
  "cell1",
  "cell2",
  "-",
  "cell3",
  "cell4",
  "-",
})
{
  {
    cells = {"cell1", "cell2"},
  },
  {
    cells = {"cell3", "cell4"},
  },
}

printTable

printTable(rows, args, [postFormatHook])

Parameters

Returns

  • A data table.

Examples

#InputResult
2
printTable(
  {
    {
      cells = {"Blue Chu Jelly", "Blue Potion"},
    },
    {
      cells = {"Red Chu Jelly", "Red Potion"},
    },
  },
  {
    game = "TWWHD",
    columns = {"Chu Jelly [Term]", "Potion [Term]"},
  }
)
The optionalColumns property allows columns to be omitted
3
printTable(
  {
    {
      cells = {"Treasure Chest", "Small Key"},
    },
    {
      cells = {"Treasure Chest", "Red Rupee"},
    },
  },
  {
    game = "PH",
    optionalColumns = {3},
    columns = {
      "Treasure Chest [Image:Model:50x50px][Term]",
      "Contents [Image:Model:50x50px][Term]",
      "Coordinates",
    },
  }
)