aboutsummaryrefslogtreecommitdiff
path: root/config.lua
blob: 7b6da99dfd9f6e716732a5b5e27418d6229f6fd1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
local utils = require 'utils'
local config = {}

local config_file = 'saved_config.lua'

config.loaded = {
    tz_shift = 0,
}

function config.load()
    local r, c = pcall(function() return dofile(config_file) end)
    if r then
        config.loaded = c
    end
end

function config.save()
    local cs = 'return '..utils.dump(config.loaded)
    local fd = file.open(config_file, 'w+')
    if fd then
        fd:write(cs)
        fd:close()
    end
end

config.load()

return config