Jump to content




disk.isPresent() always returning false.


  • You cannot reply to this topic
2 replies to this topic

#1 cheekycharlie101

  • Members
  • 231 posts

Posted 21 October 2012 - 05: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

#2 Cloudy

    Ex-Developer

  • Members
  • 2,543 posts

Posted 21 October 2012 - 06:10 PM

You're comparing true (the Boolean) to "true" (the string). Instead just do "if disk.isPresent(a) then".

#3 remiX

  • Members
  • 2,076 posts
  • LocationSouth Africa

Posted 21 October 2012 - 06:50 PM

Yeah you need to remove the quotation marks or just do if disk.isPresent(a) then - like Cloudy said





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users