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

[Lua] [Help]Redstone Input

Started by ChaddJackson12, 29 September 2012 - 07:35 PM
ChaddJackson12 #1
Posted 29 September 2012 - 09:35 PM
Ok, I would like to be able to have a computer program run, while it is running there is code inside the program that reads for a redstone input… Say, a regular program with some kind of code put inside it somewhere that will reboot the computer when the redstone input on a side turns on. Please help me with this, I thought it would have something to do with a while true loop but I can't get it to work, thanks.
Doyle3694 #2
Posted 29 September 2012 - 09:39 PM
while true do
   -- Here you put your code

   if rs.getInput("right") then
   os.shutdown()
   else
   sleep(0.1)
end
ChaddJackson12 #3
Posted 29 September 2012 - 09:41 PM
while true do
   -- Here you put your code

   if rs.getInput("right") then
   os.shutdown()
   else
   sleep(0.1)
end

Thanks for the quick response!