R/check_action.R

Defines functions check_action

Documented in check_action

#' Check if the action is valid
#' @param action a list representing an action
#' Will \link{stop} if not
#' @export
check_action <- function(action) {
  if (!is.list(action)) {
    stop("'action' must be a list")
  }
  if (!action %in% c("left", "right", "up", "down")) {
    stop("'action' must be left, right, up or down")
  }
}
informalr/snackman documentation built on March 31, 2021, 2:39 a.m.