Table
A random table that can be rolled on.
A Table is both a piece of formatted content — a grid of columns and rows rendered in
pages and detail views — and something executable: rolling on it produces a TableRoll.
Which row a roll lands on depends on the first column. When that column is named after a dice
formula such as "d100", its cells are read as ranges ("01-50", "99", "00") and matched
against the result. Otherwise rows are matched by position, one-based, and the formula defaults
to a die the size of the table.
Cells may reference other tables, and those references are rolled recursively as part of the
parent roll — so a treasure table can roll on a gems table which rolls on a magic-item table.
Recursion is capped at Constants.MAX_NESTED_ROLLS.
Examples
Section titled “Examples”A magic-item table with columns d100 and Magic Item, and rows such as
["01-50", "{#item Potion of healing}"].
- SeeAlso:
TableColumn,TableRoll
| Property | Type | Required | Description |
|---|---|---|---|
id |
string |
Yes | The unique identifier for this table. A UUID string automatically generated when the table is created. This serves as the primary key in the Realm database. |
name |
string |
Yes | The display name of the table. The primary human-readable identifier, also used as the roll’s name in the chat log. Examples: "Magic Item Table A"; "Wilderness Encounters" |
slug |
string |
Yes | A URL-friendly identifier for the table. A simplified, lowercase version of the name used to link to the table from page content and from other tables’ cells, as /table/magic-item-table-a. Examples: "magic-item-table-a" |
descr |
string |
No | The description shown above the table. Explains what the table is for and how to roll on it. |
notes |
string |
No | User-generated notes or GM notes for the table. Stores custom annotations, reminders, or campaign-specific information added by users or game masters. |
type |
any |
Yes | |
columns |
Array<TableColumn> | Yes | The table’s column headers, in display order. The first column is special: if its name is a dice formula such as "d100", its cells are read as result ranges and excluded from roll output. SeeAlso: TableColumn, firstColumnFormula |
rows |
string |
No | The table body, stored as a JSON string. A JSON array of arrays of strings — one inner array per row, one entry per column. Kept as a string rather than a Realm list because tables can be large and are always read whole. Note: Access through rowsData, which handles encoding and enforces the row limit. |
rollMode |
string |
No | How rolling behaves, as the raw value of a RollMode. Use rollModeValue for the typed form. A nil value behaves as normal. Examples: "normal", "noRepeat", "eachRow" |
rolls |
string |
No | The history of rolls made on this table, stored as a JSON string. Encoded TableRoll values. Its main purpose is noRepeat mode, which reads earlier results from here to avoid producing the same row twice. Note: Access through rollsData. |
moduleId |
any |
Yes | |
campaignId |
any |
Yes | |
parentId |
any |
Yes | |
sources |
Array<Source> | Yes | Source attributions for this table. Tracks which books, supplements, or homebrew collections this table originated from. SeeAlso: Source |
tags |
Array<string> |
Yes | Custom tags for categorization and filtering. Example Tags: "treasure", "random-encounter", "loot" |
RollMode
Section titled “RollMode”How rolling on a Table behaves.
Type: string — one of:
normalnoRepeateachRow
TableColumn
Section titled “TableColumn”One column header of a Table.
Carries the header text and how the column is laid out. The first column of a table is
significant beyond presentation: when its name is a dice formula such as "d100", the
table matches rolls against ranges in that column rather than by row position.
- SeeAlso:
Table
| Property | Type | Required | Description |
|---|---|---|---|
name |
string |
Yes | The column header text. Examples: "d100" — marks the first column as holding result ranges; "Magic Item" |
alignment |
string |
No | How cells in this column are aligned, as the raw value of an Alignment. Use alignmentValue for the typed form. A nil value falls back to centered for formula columns and leading otherwise. Examples: "left", "right", "center" |
size |
number |
No | The column’s width. Interpreted by magnitude: 0 means size to content, a value up to 1 is a fraction of the table width, and anything larger is an absolute width in points. Examples: 0 — dynamic; 0.25 — a quarter of the table; 120 — 120 points SeeAlso: sizeTitle(for:) |
TableColumn.Alignment
Section titled “TableColumn.Alignment”How cells in a TableColumn are aligned.
Type: string — one of:
leftrightcenter
TableRoll
Section titled “TableRoll”The outcome of rolling on a Table.
A roll records what was rolled and what it produced: the formula, the result, and one
TableRollDetail per cell of the matched row. Rolls nest — a detail whose cell referenced
another table carries that table’s own rolls — so a single roll can be a tree several levels
deep, which is what the rendering methods here flatten into indented text.
Unlike the other table types this is a plain Codable value, not a Realm object. It is
serialized into Table/rolls for history, into Message/content for the chat log, and
sent to the web client.
- SeeAlso:
Table,TableRollDetail,Message
| Property | Type | Required | Description |
|---|---|---|---|
id |
string |
Yes | The unique identifier for this roll. A UUID string generated when the roll is created, used to identify it in lists and in the chat log. |
name |
string |
No | The name of the table that was rolled on. Examples: "Magic Item Table A" |
formula |
string |
No | The dice expression that was rolled. Examples: "d100"; "Multiple rolls" — produced by Table/RollMode/eachRow, which rolls no dice |
result |
integer |
No | The rolled result that selected the row. For tables matched by position this is the one-based row number. In Table/RollMode/noRepeat it may be the row’s own value rather than the number actually rolled, when the rolled row was already taken. |
details |
Array<TableRollDetail> | No | The content of the matched row, one entry per cell. The range column is excluded, since it holds the lookup key rather than content. SeeAlso: TableRollDetail |
reference |
string (uri) |
No | A link back to the table this roll came from. Makes the table name tappable in the chat log and lets reroll() find the table again. Examples: "/table/6195ae04-cc85-526b-8456-56d0ab36adc2" |
TableRollDetail
Section titled “TableRollDetail”One cell of the row a TableRoll landed on.
Pairs the column header with the cell’s content, plus any rolls triggered by references inside that content — which is what makes a roll a tree rather than a flat result.
- SeeAlso:
TableRoll
| Property | Type | Required | Description |
|---|---|---|---|
name |
string |
No | The header of the column this cell came from. Examples: "Magic Item" |
value |
string |
Yes | The cell’s content, with any inline dice macros already rolled. Examples: "{#item Bag of holding}"; "3 gems worth 50 gp each" — after a 2d4 macro was resolved |
rolls |
Array<TableRoll> | No | Rolls produced by table references inside value. A reference preceded by a dice expression is rolled that many times, so one cell can yield several rolls on the same table. |

