|
| 10 May 2014 11:17 PM |
| The wiki gives me an example that shows an example of when only one request is sent to a site. How do I know what requesy im getting when multiple requests are sent to the same URL. Does it return a table? |
|
|
| Report Abuse |
|
|
MrChubbs
|
  |
| Joined: 14 Oct 2010 |
| Total Posts: 4969 |
|
|
| 10 May 2014 11:18 PM |
| Wrong forum, and your question doesn't make sense in the context of HTTP service. |
|
|
| Report Abuse |
|
|
|
| 10 May 2014 11:23 PM |
| Is this considered the wrong forum. This is where the next level scripters reside. SH is full of minor scriptors who don't know this stuff. Besides, it was a question not a request. |
|
|
| Report Abuse |
|
|
Seranok
|
  |
| Joined: 12 Dec 2009 |
| Total Posts: 11083 |
|
|
| 10 May 2014 11:24 PM |
Good question. Each call to HttpService.GetAsync or HttpService.PostAsync returns the result of that particular request, so you just have to keep track of what's returned from GetAsync like so:
local httpService = game:GetService("HttpService") local url = "http://example.org"
local resultOfFirstRequest = httpService:GetAsync(url) local resultOfSecondRequest = httpService:GetAsync(url) |
|
|
| Report Abuse |
|
|
|
| 10 May 2014 11:26 PM |
| My question is, when you use GetAsync on a URL that has recieved multiple posts, does it return a table? If not, how do I tell the difference between two data values? |
|
|
| Report Abuse |
|
|
|
| 10 May 2014 11:28 PM |
| Oh, ok. So if I were to make a constantly updating data set, how would I be able to simulate an event for when a request is posted? |
|
|
| Report Abuse |
|
|
|
| 10 May 2014 11:28 PM |
| ^ Didn't you read Seranok's post? Each getasync returns a value. |
|
|
| Report Abuse |
|
|
|
| 10 May 2014 11:29 PM |
| Oh,, I get it. So it is cronologically ordered... |
|
|
| Report Abuse |
|
|
|
| 10 May 2014 11:31 PM |
| Yes, ik. But how do I tell two separate posts apart? There is not key given as there is to data store |
|
|
| Report Abuse |
|
|
|
| 10 May 2014 11:33 PM |
There's really something you're missing here. Let me give you an example.
increment = 0
function inc() increment = increment + 1 return increment end
test = inc() test2 = inc()
Do you understand now? |
|
|
| Report Abuse |
|
|
|
| 10 May 2014 11:36 PM |
Comprehending... Comprehending...
I think I got it. Lemmie sort it out in my brain. |
|
|
| Report Abuse |
|
|
|
| 10 May 2014 11:38 PM |
Sorry for any stupidity here.
So what im thinking is that when you post async, the saved value is taking the place of the old one rather than storing a list of requests. Correct me if im wrong before I kill my computer. |
|
|
| Report Abuse |
|
|
|
| 10 May 2014 11:40 PM |
Eh... now you're confusing me.
You know how returns work, right?
HTTPService just returns the value being returned by the webpage.
So basically, you're returning the returned value of the webpage which you asked to return the data you needed from the getasync/postasync. |
|
|
| Report Abuse |
|
|
|
| 10 May 2014 11:43 PM |
| Right. So it only returns the newest value added? I understand return, but im so used to working with data store. |
|
|
| Report Abuse |
|
|
bohdan77
|
  |
| Joined: 10 Aug 2008 |
| Total Posts: 7944 |
|
|
| 10 May 2014 11:48 PM |
| You can think it in the way that when you send a request it runs the 'script' individually for that request. |
|
|
| Report Abuse |
|
|
|
| 10 May 2014 11:49 PM |
| No, the amount of times it returns is also the amount of times you called it. |
|
|
| Report Abuse |
|
|
|
| 10 May 2014 11:50 PM |
This is whats going on in my head.
function postcrap(value) return value end
local one = postcrap("bob") print(one) >bob wait(5) local two = postcrap("Joe") print(two) >Joe |
|
|
| Report Abuse |
|
|
| |
|
|
| 10 May 2014 11:52 PM |
| Is that the basic way it works, or do I have it wrong? |
|
|
| Report Abuse |
|
|
|
| 10 May 2014 11:53 PM |
| That should be how it works. Although, most of the time, it returns JSON, so you still have to decode it. |
|
|
| Report Abuse |
|
|
|
| 11 May 2014 09:42 AM |
| Of course. Most of the time I'll be encoding it too. |
|
|
| Report Abuse |
|
|
|
| 11 May 2014 11:31 AM |
send = game:GetService("HttpService") while wait(1) do script.Parent.Text = "America/Little Rock: ".. send:GetAsync("http://secretidagent.eu5.org/CDT.php",true) end
----- It sends a request to my webpage and my webpage echos something with PHP and it get returned to roblox with the current America\Los Angeles date. I also have one for central time. |
|
|
| Report Abuse |
|
|
|
| 11 May 2014 11:32 AM |
| Correction: The above was central time. |
|
|
| Report Abuse |
|
|