1
0
mirror of https://github.com/Adorable-Catgirl/LuaComp.git synced 2024-11-01 08:00:56 +11:00
LuaComp/src/shell_var.lua

17 lines
408 B
Lua
Raw Normal View History

2021-06-26 02:06:38 +10:00
-- This Source Code Form is subject to the terms of the Mozilla Public
-- License, v. 2.0. If a copy of the MPL was not distributed with this
-- file, You can obtain one at https://mozilla.org/MPL/2.0/.
2020-03-19 05:08:15 +11:00
svar = {}
2019-12-15 08:23:07 +11:00
2021-06-25 19:31:33 +10:00
do
local stdlib = require("posix.stdlib")
2019-12-15 08:23:07 +11:00
2021-06-25 19:31:33 +10:00
function svar.get(var)
return os.getenv(var)
end
2019-12-15 08:23:07 +11:00
2021-06-25 19:31:33 +10:00
function svar.set(var, val)
return stdlib.setenv(var, val and tostring(val) or nil)
end
2019-12-15 08:23:07 +11:00
end