Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function getAll(path)
- local properties = {}
- local propertiesFile = fs.open(path, "r")
- local line
- local posOfSeperator
- while true do
- line = propertiesFile.readLine()
- if line == nil then
- break
- end
- posOfSeperator = line:find("=")
- if posOfSeperator ~= nil then
- properties[line:sub(1, posOfSeperator - 1)] =
- line:sub(posOfSeperator + 1, line:len())
- end
- end
- propertiesFile.close()
- return properties
- end
- function get(path, property)
- local propertiesFile = fs.open(path, "r")
- local line
- local posOfSeperator
- while true do
- line = propertiesFile.readLine()
- if line == nil then
- break
- end
- posOfSeperator = line:find("=")
- if posOfSeperator ~= nil then
- if line:sub(1, posOfSeperator - 1) == property then
- propertiesFile.close()
- return line:sub(posOfSeperator + 1, line:len())
- end
- end
- end
- propertiesFile.close()
- return nil
- end
Advertisement
Add Comment
Please, Sign In to add comment