diff --git a/cocos/scripting/lua-bindings/manual/network/lua_downloader.cpp b/cocos/scripting/lua-bindings/manual/network/lua_downloader.cpp index 0d224ff68cca..ca26d0e0fd33 100644 --- a/cocos/scripting/lua-bindings/manual/network/lua_downloader.cpp +++ b/cocos/scripting/lua-bindings/manual/network/lua_downloader.cpp @@ -23,6 +23,7 @@ THE SOFTWARE. ****************************************************************************/ #include "lua_downloader.h" +#include "cocos2d.h" #include "network/CCDownloader.h" #include "lua_extensions.h" #include @@ -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; } @@ -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; @@ -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; } @@ -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; } @@ -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"); @@ -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; } } @@ -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"); @@ -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; } } @@ -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"); @@ -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; } }