Skip to content

Detect terminal or RStudio #20

Description

@matt-dray

In the game, the console is cleared with cat("\014") between frames. This only clears the screen in RStudio, though. In the terminal it would need to be system("clear").

Via Henrik:

To detect whether R is running via RStudio or not, one can check Sys.getenv("RSTUDIO") which is set to 1 when running in RStudio.

We can detect this on startup, set a field value and then have if statements to choose between cat("\014") and system("clear") whenever the console needs to clear.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions