function info(msg) print("info msg="..msg) end function read_cfg(name, required) local filename = "cfg-"..name if not file.open(filename, "r") then if required then panic("Could not read configuration file: "..filename) else return nil end end local value = file.readline() file.close() if value == nil or #value == 0 then if required then panic("Empty configuration file: "..filename) else return nil end end return string.sub(value, 1, -2) end function write_cfg(name, value) local filename = "cfg-"..name local ok ok = file.open(filename, "w+") if ok then ok = file.writeline(value) file.flush() file.close() end return ok end