uspgamedev / luasteam

Bindings to connect lua with Steam API
https://luasteam.readthedocs.io/en/stable/
MIT License
129 stars 23 forks source link

Multiple callresults #6

Closed yancouto closed 5 years ago

yancouto commented 5 years ago

Depends on #5

Before this PR, if you did two calls with callresults at the same time (for example, requesting different leaderboars), one of them wouldn't work. For example:

Steam.userStats.downloadLeaderboardEntries(lb_handle, "Global", 1, 10000, function(results, err)
    -- Download global stats
end)
Steam.userStats.downloadLeaderboardEntries(lb_handle, "Friends", function(results, err)
    -- Download friends stats
end)

This is very useful, like to download multiple entries, or to download data from multiple leaderboards at the same time.

With this PR each call creates its own listener that stores the callback, so it works.

yancouto commented 5 years ago

(Rebase on master after #5 was merged)