2
2
mirror of https://github.com/Hilbis/Hilbish synced 2025-04-27 07:53:23 +00:00
Hilbish/nature/env.lua
sammyette 2ca99fe831
fix!: get/set env variables via env table (#294)
this removes the old "virtual global table" which allows
getting environment variables via just their names in lua.

this means:
an environment variable (like TERM) would need to be accessed
via the `env` table instead of just using TERM in lua.

`TERM` -> `env.TERM`
they can also be set via `env.VARIABLE = 'value'
2025-04-23 19:33:09 -04:00

11 lines
152 B
Lua

env = {}
setmetatable(env, {
__index = function(_, k)
return os.getenv(k)
end,
__newindex = function(_, k, v)
os.setenv(k, tostring(v))
end
})