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

lua http help

Started by snoble2022, 11 December 2012 - 11:19 AM
snoble2022 #1
Posted 11 December 2012 - 12:19 PM
How do i create a http.request event handler to not crash a program if the site is down or there is no http.
zekesonxx #2
Posted 11 December 2012 - 02:37 PM

if not http then
  print("Please enable the HTTP API in your ComputerCraft configuration file")
  break
end
snoble2022 #3
Posted 31 December 2012 - 09:25 AM
Yes, I know that checks to see if http is on. But what about if http is on and someone enters a site that doesn't exist into a CC browser (Hint: im working on one), then the program crashes when trying to go there!
remiX #4
Posted 31 December 2012 - 10:25 AM
It will return an event… http_success and http_failure..

if event == "http_failure" then
	print("Unable to access website.")
end