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

[lua] Catch error

Started by MetalMiner, 02 November 2012 - 06:44 AM
MetalMiner #1
Posted 02 November 2012 - 07:44 AM
Hi
I createt a program wich displays the real time & date, of course using the http api.
But after a while, it throws an "attempt to index" error.
I think, this happens when the website (www.timeapi.org) can't be reached…
Now my question: Is there a way to "skip" this error and let the program continue?
Thanks!
Lyqyd #2
Posted 02 November 2012 - 07:58 AM
Check the variable that http.get returns to make sure it isn't nil before you access it.
MetalMiner #3
Posted 02 November 2012 - 08:02 AM
good idea… :D/>/>
thanks!