Skip to content

Commit

Permalink
Upgraded malformed logical message to warning
Browse files Browse the repository at this point in the history
  • Loading branch information
njlyon0 committed May 3, 2024
1 parent 4f6b475 commit b0069aa
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions R/ability_scores.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ ability_singular <- function(method = "4d6"){
if(method == "d20"){method <- "1d20"}

# Error out if method isn't specified
if(!method %in% c("4d6", "3d6", "1d20")) stop("`method` not recognized. Select one of '4d6', '3d6', '1d20', or 'd20'")
if(!method %in% c("4d6", "3d6", "1d20"))
stop("'method' not recognized. Select one of '4d6', '3d6', '1d20', or 'd20'")

# Roll appropriate number of dice
if(method == "4d6"){ for(i in 1:4){ blank[i]<- d6() } }
Expand Down Expand Up @@ -57,14 +58,13 @@ ability_scores <- function(method = "4d6", quiet = FALSE){

# Error out if method is not part of accepted list
if(!method %in% c("4d6", "3d6", "1d20", "d20"))
stop("`method` not recognized, must be one of '4d6', '3d6', '1d20', or 'd20'")
stop("'method' not recognized, must be one of '4d6', '3d6', '1d20', or 'd20'")

# Warn if quiet isn't logical
if(is.logical(quiet) != TRUE){
message("`quiet` must be a logical. Defaulting to FALSE")
warning("'quiet' must be a logical. Defaulting to FALSE")
quiet <- FALSE }


# Increase specificity of "d20" if someone enters that
if(method == "d20"){method <- "1d20"}

Expand Down

0 comments on commit b0069aa

Please sign in to comment.