r/ComputerCraft • u/DanAndTim • Jan 15 '22
the third io.read i do, no matter what, always saves as a string
doing a basic script, im trying to get back into programming and thought id mix it with minecraft. want turtle to dig a hole to my specs. asked for width, length, height. kept saying i was comparing to a string later in my code, narrowed it down to height which was the third spec i asked for. after trying many things, i tried simply moving it to the first spec. now length (which is now third spec) is said to be compared with a string.
faq: yes its digging up, my base is at bedrock. yes theres a lot of useless code, most of it is for troubleshooting or ideas i abandoned and forgot to delete. yes there is probably a more efficient way to do some of this but if it doesnt break the code, id like to challenge myself to figure it out on my own. im worried this issue at its core is a lua thing with io.read(). thank you in advance!
edit: realized it saves every read as a string, working around this now. ill edit this again tho if my efforts are fruitless. still dont know why its cool with the other 2 but not the third, though.
edit 2: i figured it out. i read io.read("*n") would work, it didn't. having it save as height = tonumber(read()) did, though.