Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function writeFile()
- if fs.exists("new.count") then
- fs.delete("new.count")
- end
- h = fs.open("new.count", "w")
- h.write("last file "..tostring(count))
- h.close()
- end
- function readFile()
- if fs.exists("new.count") then
- first = false
- h = fs.open("new.count", "r")
- count = h.readAll()
- h.close()
- count = string.gsub(count, "last file ", "")
- count = tonumber(count)
- end
- end
- first = true
- readFile()
- if first then
- count = 1
- h = fs.open("file", "w")
- h.close()
- writeFile()
- elseif not first then
- h = fs.open("file"..tostring(count), "w")
- h.close()
- count = count + 1
- writeFile()
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement