local level = 3 -- Required access level
local sideIn = "bottom" -- Keycard Input Side
local sideOut = "right" -- Redstone output side
local rsTime = 3 -- Redstone time
while true do
if disk.isPresent(sideIn) then
term.clear()
term.setCursorPos(1,1)
local code = fs.open("disk/passcode.lua", "r").readAll()
if code == nil then
local code = 0
else
local code = tonumber(code)
end
if code >= level then
print("> Access Granted")
disk.eject(sideIn)
rs.setOutput(sideOut,true)
sleep(rsTime)
rs.setOutput(sideOut,false)
else
print("> Permission Denied")
disk.eject(sideIn)
end
end
end
当没有插入磁盘时,它会抛出一个错误:
.temp:15: attempt to compare string with number expected, got string
有谁知道如何解决这个问题?我扔了一个零检查器,但它似乎不起作用。关于如何解决这个问题的任何想法?我已经尝试了至少半个小时,但我仍然没有任何线索。