edit: Made my description of problem clearer
--Just a simple function
function clearall()
term.clear()
term.setCursorPos(1,1)
end
test = 0
diskside = ""
--Just checks to see if there is a disk
check = fs.exists("disk")
if check ~= true then
test = 1
end
--The part that actually moves the programs
while test ~= 1 do
clearall()
print("What operation?")
print("download/upload")
local choice = io.read()
if choice == "download" then
test = 1
end
if choice == "upload" then
test = 1
end
clearall()
if choice == "download" then
local ondisk = fs.list("disk")
for i=1, #ondisk do
local current = fs.combine("disk",ondisk[i])
fs.delete(ondisk[i])
fs.copy(current,ondisk[i])
end
else
if choice == "upload" then
local oncomp = fs.list("")
for i=1, #oncomp do
local current = fs.combine("disk",oncomp[i])
if (oncomp[i] ~= "rom") and
(oncomp[i] ~= "disk") then
fs.delete(current)
fs.copy(oncomp[i],current)
end
end
end
end
end
if check == true then
textutils.slowPrint("Working...")
sleep(1)
print("")
print("Done")
--The part I'm having trouble with: with this code, it is not ejecting the disk
--Note: the table "side" is defined by a program that runs at startup and gives all the different sides as strings.
-- Also, when this runs, choice is supposed to either equal "upload" or "download" or else it wouldn't have broken the while
--Now, the strange thing is, if I take out the if choice == "upload" then, and the end that follows
--then it does what its supposed to do, but like this, it dosen't do anything
if choice == "upload" then
for i=#side, 1, -1 do
diskcheck = disk.isPresent(side[i])
if diskcheck == true then
diskside = side[i]
end
end
disk.eject(diskside)
end
else
print("No disk")
end