Skip to content

Commit

Permalink
Add lua downloadablePack:IsQueued()
Browse files Browse the repository at this point in the history
  • Loading branch information
nico-abram committed Jul 18, 2018
1 parent 6c5cb16 commit 6e13714
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/DownloadManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1649,6 +1649,7 @@ class LunaDownloadablePack : public Luna<DownloadablePack>
}
else
lua_pushnil(L);
IsQueued(p, L);
return 1;
}
static int GetName(T* p, lua_State* L)
Expand All @@ -1666,6 +1667,12 @@ class LunaDownloadablePack : public Luna<DownloadablePack>
lua_pushnumber(L, p->avgDifficulty);
return 1;
}
static int IsQueued(T* p, lua_State* L)
{
auto it = std::find(DLMAN->DownloadQueue.begin(), DLMAN->DownloadQueue.end(), p);
lua_pushboolean(L, it != DLMAN->DownloadQueue.end());
return 1;
}
static int IsDownloading(T* p, lua_State* L)
{
lua_pushboolean(L, p->downloading ==0);
Expand All @@ -1683,6 +1690,7 @@ class LunaDownloadablePack : public Luna<DownloadablePack>
{
ADD_METHOD(DownloadAndInstall);
ADD_METHOD(IsDownloading);
ADD_METHOD(IsQueued);
ADD_METHOD(GetAvgDifficulty);
ADD_METHOD(GetName);
ADD_METHOD(GetSize);
Expand Down

0 comments on commit 6e13714

Please sign in to comment.