random en 9gag

This commit is contained in:
yago 2014-08-05 14:20:53 +02:00
parent 0a6f071154
commit 0264ac2935

View File

@ -233,6 +233,7 @@ end
function get_infiniGAG() function get_infiniGAG()
b, c, h = http.request("http://infinigag-us.aws.af.cm") b, c, h = http.request("http://infinigag-us.aws.af.cm")
local gag = json:decode(b) local gag = json:decode(b)
math.randomseed(os.time())
i = math.random(#gag.data) -- random max json table size (# is an operator o.O) i = math.random(#gag.data) -- random max json table size (# is an operator o.O)
local link_image = gag.data[i].images.normal local link_image = gag.data[i].images.normal
print("9gag image"..link_image) print("9gag image"..link_image)