Add fetchScores
This commit is contained in:
parent
ccc4f75a68
commit
681f0439a0
19
gamejolt.lua
19
gamejolt.lua
@ -185,4 +185,23 @@ function GJ.addScore(score, desc, tableID, guestName, extraData)
|
|||||||
return string.find(req("scores/add/?score=" .. tostring(desc) .. "&sort=" .. score .. s, "dump", pu, pt), "SUCCESS") ~= nil
|
return string.find(req("scores/add/?score=" .. tostring(desc) .. "&sort=" .. score .. s, "dump", pu, pt), "SUCCESS") ~= nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function GJ.fetchScores(limit, tableID)
|
||||||
|
local pu, pt, s = true, true, ""
|
||||||
|
if tableID then pu, pt, s = false, false, "&table_id=" .. tostring(tableID) end
|
||||||
|
|
||||||
|
local d = req("scores/?limit=" .. tostring(limit) .. s, "keypair", pu, pt)
|
||||||
|
local t, f = {}
|
||||||
|
|
||||||
|
parseKeypair(d, function(k, v)
|
||||||
|
if k ~= "success" then
|
||||||
|
if k == "score" then
|
||||||
|
f = {}
|
||||||
|
table.insert(t, f)
|
||||||
|
end
|
||||||
|
f[k] = v
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
return t
|
||||||
|
end
|
||||||
|
|
||||||
return GJ
|
return GJ
|
Reference in New Issue
Block a user