generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: http service

Previous Thread :: Next Thread 
nighttimeninja314 is not online. nighttimeninja314
Joined: 04 Apr 2011
Total Posts: 4001
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 is not online. 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
nighttimeninja314 is not online. nighttimeninja314
Joined: 04 Apr 2011
Total Posts: 4001
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 is not online. 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
nighttimeninja314 is not online. nighttimeninja314
Joined: 04 Apr 2011
Total Posts: 4001
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
nighttimeninja314 is not online. nighttimeninja314
Joined: 04 Apr 2011
Total Posts: 4001
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
AndroidKitKat is not online. AndroidKitKat
Joined: 21 Sep 2013
Total Posts: 1525
10 May 2014 11:28 PM
^ Didn't you read Seranok's post? Each getasync returns a value.
Report Abuse
nighttimeninja314 is not online. nighttimeninja314
Joined: 04 Apr 2011
Total Posts: 4001
10 May 2014 11:29 PM
Oh,, I get it. So it is cronologically ordered...
Report Abuse
nighttimeninja314 is not online. nighttimeninja314
Joined: 04 Apr 2011
Total Posts: 4001
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
AndroidKitKat is not online. AndroidKitKat
Joined: 21 Sep 2013
Total Posts: 1525
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
nighttimeninja314 is not online. nighttimeninja314
Joined: 04 Apr 2011
Total Posts: 4001
10 May 2014 11:36 PM
Comprehending... Comprehending...

I think I got it. Lemmie sort it out in my brain.
Report Abuse
nighttimeninja314 is not online. nighttimeninja314
Joined: 04 Apr 2011
Total Posts: 4001
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
AndroidKitKat is not online. AndroidKitKat
Joined: 21 Sep 2013
Total Posts: 1525
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
nighttimeninja314 is not online. nighttimeninja314
Joined: 04 Apr 2011
Total Posts: 4001
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 is not online. 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
AndroidKitKat is not online. AndroidKitKat
Joined: 21 Sep 2013
Total Posts: 1525
10 May 2014 11:49 PM
No, the amount of times it returns is also the amount of times you called it.
Report Abuse
nighttimeninja314 is not online. nighttimeninja314
Joined: 04 Apr 2011
Total Posts: 4001
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
AndroidKitKat is not online. AndroidKitKat
Joined: 21 Sep 2013
Total Posts: 1525
10 May 2014 11:51 PM
^ Pretty much.
Report Abuse
nighttimeninja314 is not online. nighttimeninja314
Joined: 04 Apr 2011
Total Posts: 4001
10 May 2014 11:52 PM
Is that the basic way it works, or do I have it wrong?
Report Abuse
AndroidKitKat is not online. AndroidKitKat
Joined: 21 Sep 2013
Total Posts: 1525
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
nighttimeninja314 is not online. nighttimeninja314
Joined: 04 Apr 2011
Total Posts: 4001
11 May 2014 09:42 AM
Of course. Most of the time I'll be encoding it too.
Report Abuse
secretidagent is not online. secretidagent
Joined: 07 Nov 2010
Total Posts: 1600
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
secretidagent is not online. secretidagent
Joined: 07 Nov 2010
Total Posts: 1600
11 May 2014 11:32 AM
Correction: The above was central time.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image