Skip to content
Jason Godesky edited this page Jul 17, 2026 · 1 revision

roll is a wrapper that rolls dice and returns the result.

Parameters

expr: string

A dice expression to roll (e.g., 2d6 or 1d20).

Note that this wrapper used the evaluateSync method, which can throw an error for certain complex expressions that require asynchronous behavior. In those cases, your needs are complex enough to warrant instantiating a Roll instance and handling it directly.

Returns

The total from the roll.

Examples

import { roll } from '@revolutionarygamesco/common-foundryvtt'

roll('1d6') // 1, 2, 3, 4, 5, or 6

Clone this wiki locally