I wanted to ask if its possible to get the content of the http.Fetch function somehow outside? I tried returning, and I tried using a local var which is created before the fetching, and the fetching sets it, but its still nil…
http.Fetch is an asynchronous function. It will ALWAYS return nil.
If it were synchronous, the whole game would freeze while it connects to the url in question, does all the handshaking stuff, then retrieves the page content. That’s why you pass it two callback functions. One for what to do once you DO have the data, and one for what to do if it fails to get the data.
You didnt fully understand, I made it so it sets an EXISTING var with the content.
http.Fetch() itself returns nil.
If you’re talking about a callback setting the variable, again: Asynchronous, it won’t be set until the data actually comes back. By that time, whatever function called http.Fetch() in the first place will be long-since finished running.