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

Ensure CLI results for rolling dice are printed as integers #27

Merged
merged 1 commit into from
Nov 25, 2024

Conversation

QMalcolm
Copy link
Collaborator

Is there an associated github issue?

resolves #26

What is this PR changing?

IO.inspect by default treats lists of integers as charlists. This means certain integer combinations result in the list being printed as charlist. This was rather confusing, as getting ~c"\a\n" when rolling 2d10 doesn't make much sense (~c"\a\n" == [7, 10]). To force IO.inspect to read the list as a list of integers, we had to pass charlists: :as_lists in the opts of the function.

`IO.inspect` by default treats lists of integers as `charlists`. This
means certain integer combinations result in the list being printed as
`charlist`. This was rather confusing, as getting `~c"\a\n"` when
rolling `2d10` doesn't make much sense (`~c"\a\n"` == `[7, 10]`). To
force `IO.inspect` to read the list as a list of integers, we had to
pass `charlists: :as_lists` in the opts of the function.
@QMalcolm QMalcolm merged commit 1bb2563 into main Nov 25, 2024
1 check passed
@QMalcolm QMalcolm deleted the qmalcolm--fix-roll-rendering-ascii-bug branch December 5, 2024 04:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] Sometimes results for rolling dice renders results as ascii string
1 participant