sys.env
Get a proxy table representing environment variables. To set or get an environment variable, just index the table with the variable name.
Example
-- get the current Windows installation path
print("Windows installation path: "..sys.env["windir"])
-- set the local environment variable "root"
sys.env["root"] = "C:\\"
print("root environment variable: "..sys.env["root"])