Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local config = {
- osVersion = 'Alpha 1.25';
- osColor = 'true';
- }
- function loadConfig()
- local loaded = {}
- if fs.exists('xos/.ini') then
- local file = fs.open('xos/.ini', 'r')
- for line in file.readLine do
- local key, value = line:match('([%w_]+)%s+(.*)')
- loaded[key] = value
- end
- return loaded, file.close()
- else
- return config
- end
- end
- function saveConfig()
- local content = ''
- for k,v in pairs(config) do
- content = content..k..' '..tostring(v)..'\n'
- end
- local file = fs.open('xos/.ini', 'w')
- file.write(content)
- file.close()
- end
- term.setCursorPos(1,1)
- term.clear()
- function displayConfig()
- local content = ''
- for k,v in pairs(config) do
- write(content..k..' '..tostring(v)..'\n')
- end
- end
- config = loadConfig()
- displayConfig()
- saveConfig()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement