Jump to content




ComputerCraft Clock

computer peripheral command

3 replies to this topic

#1 michaelcampbell229

  • Members
  • 17 posts

Posted 09 August 2015 - 03:50 AM

I have this code:


moniter = peripheral.wrap("back")
moniter.setTextScale(3)
while true do
sleep(0.75)
moniter.setCursorPos(1,1)
moniter.clear()
moniter.write(textutils.formatTime(os.time().true))
end
moniter.restore()


I know this code did work, i saw it on a Youtube video (it was uploaded in 2013) and i was wondering why it doesnt work anymore, or did i make a typo?

Edited by michaelcampbell229, 09 August 2015 - 06:51 AM.


#2 Lyqyd

    Lua Liquidator

  • Moderators
  • 8,465 posts

Posted 09 August 2015 - 05:42 AM

Moved to Ask a Pro.

#3 HPWebcamAble

  • Members
  • 933 posts
  • LocationWeb Development

Posted 09 August 2015 - 06:06 AM

What happens when you run it?



I'd assume it doesn't work because of this:
(Should throw an 'attempt to index number' I believe)
moniter.write(textutils.formatTime(os.time().true))
(The arguments in question here are 'os.time()' and 'true')

Instead of a period (.), you need to use a comma (,) to separate the arguments, like this:
moniter.write(textutils.formatTime(os.time(),true))

Edited by HPWebcamAble, 09 August 2015 - 06:07 AM.


#4 michaelcampbell229

  • Members
  • 17 posts

Posted 09 August 2015 - 07:01 AM

Thanks HPWebcamAble that fixed everything. I didnt notice the comma!

I fixed the first post so the code was in the code format, just learnt how to do it.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users