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

Big reactor

Started by Blade2277, 26 February 2019 - 03:53 AM
Blade2277 #1
Posted 26 February 2019 - 04:53 AM
I am writing a program to control my big reactor but i am stuck on making the UI. I cant get it to enter the computer to enter the if statement, it just ignores it.

print("Press 1 to edit control rod settings")
a = io.read()
if a==1 then
   print("Enter Control Rod settings")
End
Bomb Bloke #2
Posted 27 February 2019 - 02:45 PM
io.read() always returns strings, but 1 is a number: so your condition will never be true.

http://lua-users.org/wiki/LuaTypesTutorial

You could do:

if a=="1" then

Or, instead:

a = tonumber(io.read())