Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting expressions from DiceRoll #241

Closed
erik-jenkins opened this issue Feb 16, 2022 · 2 comments
Closed

Getting expressions from DiceRoll #241

erik-jenkins opened this issue Feb 16, 2022 · 2 comments
Labels

Comments

@erik-jenkins
Copy link

Hi there! I'm enjoying the library a lot, but I had a question. If I wanted to get the expressions associated with a particular DiceRoll, how would I do that? Ultimately I'm trying to implement a different way other than the default string to surface roll results, and for that I need to know which groups of dice (e.g. 3d6+4d8) returned which, without doing some hacky parsing of the string or RollResults. Thanks in advance!

@aarku
Copy link

aarku commented Feb 18, 2022

Just iterate through diceRoll.rolls. Each item is either string, number, Results.RollResults, Result.ResultGroup, or Results.RollResult

@GreenImp
Copy link
Collaborator

I'm closing this, as it's covered in #242 with a little bit more info / discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants