Posted 10 September 2012 - 04:08 PM
i want to make a program that counts the time people has been near the computer.
but i want to save the information at a server restart so i used fs.open, but i get the error message:
this is my code
but i want to save the information at a server restart so i used fs.open, but i get the error message:
Spoiler
startup:8: attempt to perform arithmetic __add on table and number
Spoiler
s1 = fs.open("sec", "w")
m1 = fs.open("min", "w")
term.clear()
term.setCursorPos(1, 1)
print("people has been around spawn for ", m, ":", s, " seconds")
sleep(1)
s1 = s1 + 1
fs.delete("sec")
s1.writeLine(s)
if s1 == 60 then
m1 = m1 + 1
fs.delete("min")
m1.writeLine(m)
fs.delete("sec")
s1 = 0
shell.run("startup")
end