Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Httpservice random.org api help?

Asked by 10 years ago

I have no idea how to return the table of functions for the random.org api. Can anyone help?

1 answer

Log in to vote
0
Answered by
Destrings 406 Moderation Voter
10 years ago

You could have read the page, it's well documented.

Basically you set the url like http://www.random.org/integers/?min=1&max=100&num=25&base=10&format=plain&rnd=new&col=1

All parameters are self explanatory. So

function getRandom(mi, ma, n)
    local http = game:GetService("HttpService")
    return http:GetAsync(("http://www.random.org/integers/?min=%d&max=%d&num=%d&base=10&format=plain&rnd=new&col=1"):format(mi,ma,n))
end

Where mi is the minimun number, ma is the maximun number, and n is the amount of numbers to generete, you will need need to parse the result string, but that's easily done with patterns. Make sure HTTPservice is enabled

0
No, I meant return the api as a table rens321 1 — 10y
0
Um... What? You can't do that. The API just specifies how to send requests. You need to write your implementation. It's not going to return you a table of Lua functions to manipulate it. Destrings 406 — 10y
Ad

Answer this question