ComputerCraft Forums

ComputerCraft => Ask a Pro => Topic started by: Yixuan on Jul 14, 2023, 10:40 PM

Title: attempt to index local "reader" (a nil value)
Post by: Yixuan on Jul 14, 2023, 10:40 PM
i know that "attempt to index local "reader" (a nil value)" means that i try to call/read a value that didnt exist but i dont know what im doing worng in my code

print("program started")

local reader = peripheral.find("ship_reader")
redstone.setOutput("top",true)

while true do
repeat

local result = reader.getWorldspacePosition()
sleep(0.1)

until (result.y == 90)

redstone.setOutput("top",false)

end
Title: attempt to index local "reader" (a nil value)
Post by: Lupus590 on Jul 15, 2023, 03:19 PM
Reader is nil, which means that the peripheral was not found. "ship_reader might not be the correct peripheral type, your network may not be set up correctly, or you could be missing a compatibility mod.