Srd.Dice.Expr (srd_5e v0.2.0)

Copy Markdown View Source

A parsed, unrolled dice expression. A dice expression can be built manually or can be parsed from human-readable dice notation like d20, 2d4+1, etc.

Summary

Types

t()

@type t() :: %Srd.Dice.Expr{
  count: pos_integer(),
  modifier: integer(),
  sides: pos_integer()
}

Functions

parse(expr)

@spec parse(String.t() | t()) :: {:ok, t()} | {:error, {:invalid_dice, String.t()}}

parse!(input)

@spec parse!(String.t() | t()) :: t()