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

Monitor does not refresh

Started by LAK, 19 July 2015 - 03:19 PM
LAK #1
Posted 19 July 2015 - 05:19 PM
Hey,
I'm trying to figure out computercraft with some basic stuff, but I have no idea why my monitor does not refresh. It shows the time but then does not update anymore. I tried looking into the forums but I could not find an answer.

Thanks in advance!


local monitor = peripheral.wrap( "top" )
local time = os.time()

while true do

  monitor.setCursorPos(1,1)
  monitor.write(textutils.formatTime(time,true))
  sleep(1)

end
KingofGamesYami #2
Posted 19 July 2015 - 09:04 PM
The monitor is updating. The value of time is not. You initially set time to the time you started the program, then never change it. Therefor, you loop will continue to write the same value to your monitor every second.