Posted 30 December 2013 - 06:16 AM
I am trying to make an auto-download script that allows me to sync user-files from a remote CC server
But whenever I run it it says attempt to index? (a nil value) when it reaches
Thx for your help!
function startdownload(ID)
ID,path,othr = rednet.receive()
if path == "done" then
print("Exiting...")
sleep(2)
error()
elseif path ~= "/" then
shell.run("mkdir "..path)
print("Computer "..ID.." connected!")
rednet.send(ID,"path",true)
ID,flnm,othr = rednet.receive()
rednet.send(ID,"flnm",true)
ID,file,othr = rednet.receive()
filenm = path..flnm
print("Finished string: "..filenm)
flwrite = fs.open(filenm,"w")
print("Downloading...")
flwrite.write(file)
flwrite.close()
print("Download completed!")
else
print("Computer "..ID.." connected!")
rednet.send(ID,"path",true)
ID,flnm,othr = rednet.receive()
rednet.send(ID,"flnm",true)
ID,file,othr = rednet.receive()
filenm = path..flnm
print("Finished string: "..filenm)
flwrite = fs.open(filenm,"w")
print("Downloading...")
flwrite.write(file)
flwrite.close()
print("Download completed!")
end
end
But whenever I run it it says attempt to index? (a nil value) when it reaches
flwrite.write(file)
Thx for your help!