Posted 17 October 2012 - 06:32 AM
alright, so while writing a code (I'm a beginner so I'm not claiming that I know at all what I'm doing) for checking for at least a number (stored in variable Q) yet it doesn't work
Here's the function code…
(…If turtle.getItemSpace(i) < Q then…)
the computer returns an error when I try to test the function just to see if it would work, (attempt to compare string with number expected, got string)
Am I doing this wrong? should it be written a different way? Please let me know!
also, if anyone knows how to just make the whole program pause or end, at a certain piece of code. Please let me know as well.
Thanks for your time and hopefully your effort to facepalm as you reluctantly say I'm stupid and help me out.
Here's the function code…
local Q = read()
function checkSupply()
for i= 1, 16 do
turtle.select(i)
if turtle.getItemSpace(i) < Q then
print("supply "..i" is low")
if i == 16 then
print("not enough supplies")
break
end
end
end
end
(…If turtle.getItemSpace(i) < Q then…)
the computer returns an error when I try to test the function just to see if it would work, (attempt to compare string with number expected, got string)
Am I doing this wrong? should it be written a different way? Please let me know!
also, if anyone knows how to just make the whole program pause or end, at a certain piece of code. Please let me know as well.
Thanks for your time and hopefully your effort to facepalm as you reluctantly say I'm stupid and help me out.