dice-roller/rpg-dice-roller

Getting expressions from DiceRoll

erik-jenkins opened this issue · 2 comments

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 commented

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

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