mirror of
https://github.com/kepler155c/opus
synced 2024-12-28 01:20:27 +00:00
24 lines
454 B
Lua
24 lines
454 B
Lua
local Util = require('util')
|
|
|
|
local Config = { }
|
|
|
|
Config.load = function(fname, data)
|
|
local filename = '/config/' .. fname
|
|
|
|
if not fs.exists('/config') then
|
|
fs.makeDir('/config')
|
|
end
|
|
|
|
if not fs.exists(filename) then
|
|
Util.writeTable(filename, data)
|
|
else
|
|
Util.merge(data, Util.readTable(filename) or { })
|
|
end
|
|
end
|
|
|
|
Config.update = function(fname, data)
|
|
local filename = '/config/' .. fname
|
|
Util.writeTable(filename, data)
|
|
end
|
|
|
|
return Config |