Posted 20 November 2014 - 03:39 PM
I'm trying to make a floppy lock program. It should emit a redstone signal when a floppy is inserted, and disable it when it is removed. However, I can't get it to disable the signal when the floppy is removed.
Code: (relevant parts line 11-15)
Code: (relevant parts line 11-15)
-- side
local outputSide = "bottom"
-- key disk id
local keyDiskID = 1
while true do
local rawEvent = {coroutine.yield()}
local event = rawEvent[1]
if event == "disk" then
local side = rawEvent[2]
if disk.getID(side) == keyDiskID then
rs.setOutput(outputSide,true)
local rawEvent = {coroutine.yield()}
local event = rawEvent[1]
if event == "disk_eject" then
rs.setOutput(outputSide,false)
end
else
disk.eject(side)
end
end
end