Environment Variables in AngelScript
Environment variables are a universal mechanism for conveying configuration information to programs. Let’s look at how to set, get, and list environment variables.
Running the program shows that we pick up the value for FOO
that we set in the program, but that BAR
is empty.
The list of keys in the environment will depend on your particular machine.
If we set BAR
in the environment first, the running program picks that value up.
Note: AngelScript doesn’t have built-in functions for environment variables, so this example assumes the existence of custom functions setEnvironmentVariable
, getEnvironmentVariable
, and getEnvironmentVariables
. In a real AngelScript environment, you would need to implement these functions using the host application’s API or some other method to interact with the system’s environment variables.