Skip to content

Latest commit

 

History

History
34 lines (25 loc) · 1.02 KB

README.md

File metadata and controls

34 lines (25 loc) · 1.02 KB

Roll Go Report Card License GoDoc Build Status

A simple dice roll parsing engine that (mostly) supports the Roll20 Dice Rolling Language Specification

Usage

package main

import (
	"fmt"
	"math/rand"
	"os"
	"time"

	"github.com/darkliquid/roll"
)

func main() {
	rand.Seed(time.Now().UnixNano())
	out, err := roll.Parse(os.Stdin)
	if err != nil {
		fmt.Fprintln(os.Stderr, err)
		return
	}
	fmt.Println(out)
}

then run echo '3d6+1' | go run main.go to get some output like:

Rolled "3d6+1" and got 6, 6, 4 for a total of 17