Posted 09 April 2012 - 12:41 PM
hi all!
I'm writing a program to create floppy copies, but i get "attempt to call nil" on disk API, I also tried putting os.loadAPI("disk"), but nothing changes
I get "attempt to call nil" on line 9, exactly:
if i set "disk/access", it writes successfully but stops at line 14
sorry for bad english.. i'm italian
I'm writing a program to create floppy copies, but i get "attempt to call nil" on disk API, I also tried putting os.loadAPI("disk"), but nothing changes
print("Sending signal..")
rs.setOutput("top", true)
os.sleep(0.5)
rs.setOutput("top", false)
os.sleep(0.3)
dsk, side = os.pullEventRaw()
if dsk == "disk" then
print("Writing...")
file,err = io.open(disk.getMountPath(side).."/access", "w")
file:write("please open the door")
print("File writed!")
file:close()
print("Ejecting..")
disk.setLabel(side, "Magnetic access card")
os.sleep(0.3)
disk.eject(side)
end
Here's the code.I get "attempt to call nil" on line 9, exactly:
file,err = io.open(disk.getMountPath(side).."/access", "w")
Help..if i set "disk/access", it writes successfully but stops at line 14
sorry for bad english.. i'm italian