Jump to content




lua http help


3 replies to this topic

#1 snoble2022

  • Members
  • 100 posts
  • LocationSomewhere near the local computer store?

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.

#2 zekesonxx

  • Signature Abuser
  • 263 posts
  • LocationWhere you aren't

Posted 11 December 2012 - 02:37 PM

if not http then
  print("Please enable the HTTP API in your ComputerCraft configuration file")
  break
end


#3 snoble2022

  • Members
  • 100 posts
  • LocationSomewhere near the local computer store?

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!

#4 remiX

  • Members
  • 2,076 posts
  • LocationSouth Africa

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






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users