Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions cocos/scripting/lua-bindings/manual/network/lua_downloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ THE SOFTWARE.
****************************************************************************/
#include "lua_downloader.h"

#include "cocos2d.h"
#include "network/CCDownloader.h"
#include "lua_extensions.h"
#include <iostream>
Expand Down Expand Up @@ -57,7 +58,7 @@ static std::string get_field_string(lua_State *L, const char *field, const char
lua_gettable(L, -2);
if (lua_isnil(L, -1))
{
//luaL_error(L, "get_field_string: field '%s' no exists.", field);
//CCLOGERROR("get_field_string: field '%s' no exists.", field);
lua_pop(L, 1);
return ret;
}
Expand Down Expand Up @@ -117,7 +118,7 @@ static int lua_downloader_new(lua_State *L)
if (argc >= 1) {
//parse DownloaderHints
if (!lua_istable(L, -1)) {
luaL_error(L, "cc.Downloader.new: first argument should be table if set");
CCLOGERROR("cc.Downloader.new: first argument should be table if set");
return 0;
}
DownloaderHints hints;
Expand Down Expand Up @@ -155,7 +156,7 @@ static int lua_downloader_createDownloadDataTask(lua_State *L)

if (argc == 0)
{
luaL_error(L, "cc.Downloader.createDownloadDataTask parameter error");
CCLOGERROR("cc.Downloader.createDownloadDataTask parameter error");
return 0;
}

Expand All @@ -177,7 +178,7 @@ static int lua_downloader_createDownloadFileTask(lua_State *L)

if (argc < 2)
{
luaL_error(L, "cc.Downloader.createDownloadFileTask parameter error!");
CCLOGERROR("cc.Downloader.createDownloadFileTask parameter error!");
return 0;
}

Expand All @@ -195,7 +196,7 @@ static int lua_downloader_setOnFileTaskSuccess(lua_State *L)
int argc = lua_gettop(L) - 1;
Downloader *d = checkDownloader(L);
if (argc != 1) {
luaL_error(L, "cc.Downloader.setOnFileTaskSuccess parameter error!");
CCLOGERROR("cc.Downloader.setOnFileTaskSuccess parameter error!");
return 0;
}
luaL_argcheck(L, lua_isfunction(L, 2), 2, "should be a function");
Expand All @@ -209,7 +210,7 @@ static int lua_downloader_setOnFileTaskSuccess(lua_State *L)
if (lua_pcall(L, 1, 0, 0) != 0)
{
lua_pop(L, 1); // remove callback or nil
luaL_error(L, "cc.Downloader.setOnFileTaskSuccess invoke callback error!");
CCLOGERROR("cc.Downloader.setOnFileTaskSuccess invoke callback error!");
return;
}
}
Expand All @@ -225,7 +226,7 @@ static int lua_downloader_setOnTaskProgress(lua_State *L)
Downloader *d = checkDownloader(L);
int argc = lua_gettop(L) - 1;
if (argc != 1) {
luaL_error(L, "cc.Downloader.setOnTaskProgress parameter error!");
CCLOGERROR("cc.Downloader.setOnTaskProgress parameter error!");
return 0;
}
luaL_argcheck(L, lua_isfunction(L, 2), 2, "should be a function");
Expand All @@ -245,7 +246,7 @@ static int lua_downloader_setOnTaskProgress(lua_State *L)
if (lua_pcall(L, 4, 0, 0) != 0)
{
lua_pop(L, 1); // remove callback or nil
luaL_error(L, "cc.Downloader.setOnTaskProgress invoke callback error!");
CCLOGERROR("cc.Downloader.setOnTaskProgress invoke callback error!");
return;
}
}
Expand All @@ -261,7 +262,7 @@ static int lua_downloader_setOnTaskError(lua_State *L)
Downloader *d = checkDownloader(L);
int argc = lua_gettop(L) - 1;
if (argc != 1) {
luaL_error(L, "cc.Downloader.setOnTaskError parameter error!");
CCLOGERROR("cc.Downloader.setOnTaskError parameter error!");
return 0;
}
luaL_argcheck(L, lua_isfunction(L, 2), 2, "should be a function");
Expand All @@ -281,7 +282,7 @@ static int lua_downloader_setOnTaskError(lua_State *L)
if (lua_pcall(L, 4, 0, 0) != 0)
{
lua_pop(L, 1); // remove callback or nil
luaL_error(L, "cc.Downloader.setOnTaskError invoke callback error!");
CCLOGERROR("cc.Downloader.setOnTaskError invoke callback error!");
return;
}
}
Expand Down