ccrma / chuck

ChucK Music Programming Language
http://chuck.stanford.edu/
GNU General Public License v2.0
816 stars 130 forks source link

Std.getenv(key, default_value) variant #341

Closed ynohtna closed 1 year ago

ynohtna commented 1 year ago

A simple 2 argument variant of Std.getenv where the second string argument is the default value returned if the requested environment variable is unset.

Simplifies

Std.getenv("COOL_PROG_OSC_ADDRESS") => string addr;
if (addr == "") {
  "127.0.0.1" => addr;
}

to Std.getenv("COOL_PROG_OSC_ADDRESS", "127.0.0.1") => string osc_in_port;