Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --[[function readConf(file,key)
- local file=fs.open(file,"r")
- while true do
- sText=file.readLine()
- local start=string.find(sText,"=")
- if string.sub(sText,1,start)==key then
- break
- end
- end
- file.close()
- local start=string.find(sText,"=")
- return string.sub(sText,start+1,#sText)
- end]]
- function read(sFile,key)
- if not fs.exists(sFile..".ltx") then error("No such file") end
- local file = fs.open(sFile..".ltx","r")
- while true do
- local line = file.readLine()
- if line ~= nil then
- local key, value = string.match(line,"(.*)=(.*)")
- if value ~= nil and key == key then
- file.close()
- return value
- end
- else
- file.close()
- break
- end
- end
- end
- function write(sfile,key,value)
- local file=fs.open(sfile..".ltx","a")
- file.writeLine(key.."="..value)
- file.close()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement