Make NOHTTP transparent to the Lua API

Also, HTTPRequest:status would never have returned queued since
the request is started immediately on creation.
This commit is contained in:
Tamás Bálint Misius
2020-01-18 01:33:40 +01:00
parent 194c50ae3c
commit 89282806e6

View File

@@ -153,9 +153,7 @@ LuaScriptInterface::LuaScriptInterface(GameController * c, GameModel * m):
initFileSystemAPI();
initPlatformAPI();
initEventAPI();
#ifndef NOHTTP
initHttpAPI();
#endif
//Old TPT API
int currentElementMeta, currentElement;
@@ -3726,11 +3724,6 @@ public:
return dead || request->CheckDone();
}
bool Running() const
{
return !dead && request->CheckStarted();
}
void Progress(int *total, int *done)
{
if (!dead)
@@ -3781,13 +3774,9 @@ static int http_request_status(lua_State *l)
{
lua_pushliteral(l, "done");
}
else if (rh->Running())
{
lua_pushliteral(l, "running");
}
else
{
lua_pushliteral(l, "queued");
lua_pushliteral(l, "running");
}
return 1;
}