This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
cheekycharlie101's profile picture

disk.isPresent() always returning false.

Started by cheekycharlie101, 21 October 2012 - 04:50 PM
cheekycharlie101 #1
Posted 21 October 2012 - 06:50 PM
ok so im working my way through a program that labels a disk for you from scratch. i know this is pointless but im testing for what i can do. anyway so far i have made it check if the disk is present. but its always returning false. can someone help me out?

Heres my code

write("Enter Drive Side: ")
a = io.read()
if a == "top" or a == "bottom" or a == "left" or a == "right" or a == "front" or a == "back" then
disk.isPresent(a)
if disk.isPresent(a) == "true" then
print("true")
else
print("false")
end
end
this is always printing false when a disk is present? can someone help me out here? thanks
-Cheeky
Cloudy #2
Posted 21 October 2012 - 07:10 PM
You're comparing true (the Boolean) to "true" (the string). Instead just do "if disk.isPresent(a) then".
remiX #3
Posted 21 October 2012 - 07:50 PM
Yeah you need to remove the quotation marks or just do if disk.isPresent(a) then - like Cloudy said