Posted 04 April 2016 - 10:22 AM
Hello everyone!
I am getting the error "disk:3: Expected string" when attempting to run my program.
I have put debugging methods in and it says "Lock started!" and "Found the staff member!"
Here is the code:
Any help will be appreciated,
Astrophylite.
I am getting the error "disk:3: Expected string" when attempting to run my program.
I have put debugging methods in and it says "Lock started!" and "Found the staff member!"
Here is the code:
local oldPull = os.pullEvent
os.pullEvent = os.pullEventRaw
local doorLoc = "left"
local sleepTime = 2
local staff = {"cookemoonster","Astrophylite"}
local staffMember = false
term.clear()
term.setCursorPos(1,1)
while true do
print("Lock started!")
if(disk.isPresent("top") and disk.hasData("top")) then
for _,v in pairs(staff) do
if v == disk.getLabel("top") then
print("Found the staff member!")
staffMember = true
break
end
end
if(staffMember) then
local file = io.open("/disk/hash","r")
local localHash = io.open("/users/"..disk.getLabel(),"r")
if(file:readLine() == localHash:readLine()) then
print("The hash is correct!")
rs.setOutput(doorLoc, true)
sleep(sleepTime)
rs.setOutput(doorLoc, false)
disk.eject("top")
print(disk.getLabel("top") .. " unlocked the door!")
else
print(disk.getLabel("top") .. " didn't have a valid hash!")
disk.eject("top")
end
end
sleep(0.5)
else
sleep(0.5)
end
end
Any help will be appreciated,
Astrophylite.