In my code, I need the headers from a URL, so I use this:
location = ""
http.request(url, "HEAD", function(self, id, response)
location = response.headers.location
end)
The code afterwards keeps going before the response arrives, so whenever I reference location
outside of the callback function before it’s finished, I just get a blank string. If I do something like while location == "" do end
after http.request()
, it seems to also stop the callback function from running.