@@ -22,6 +22,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
22
THE SOFTWARE.
23
23
****************************************************************************/
24
24
#include " lua_downloader.h"
25
+ #include " scripting/lua-bindings/manual/CCLuaValue.h"
25
26
26
27
#include " network/CCDownloader.h"
27
28
#include < iostream>
@@ -171,22 +172,35 @@ static int lua_downloader_createDownloadFileTask(lua_State* L)
171
172
{
172
173
int argc = lua_gettop (L) - 1 ;
173
174
Downloader* d = checkDownloader (L);
174
- std::string url = " " ;
175
- std::string storagePath = " " ;
176
- std::string identifier = " " ;
175
+ std::string_view url = " " sv ;
176
+ std::string_view storagePath = " " sv ;
177
+ std::string_view identifier = " " sv ;
177
178
178
179
if (argc < 2 )
179
180
{
180
181
luaL_error (L, " ax.Downloader.createDownloadFileTask parameter error!" );
181
182
return 0 ;
182
183
}
183
184
184
- url = lua_tostring (L, 2 );
185
- storagePath = lua_tostring (L, 3 );
185
+ url = axislua_tosv (L, 2 );
186
+ storagePath = axislua_tosv (L, 3 );
186
187
if (argc > 2 )
187
- identifier = lua_tostring (L, 4 );
188
+ identifier = axislua_tosv (L, 4 );
188
189
189
- auto tsk = d->createDownloadFileTask (url, storagePath, identifier);
190
+ std::string_view md5checksum = " " sv;
191
+ std::string_view cacertPath = " " sv;
192
+ bool background = false ;
193
+
194
+ if (argc > 3 )
195
+ md5checksum = axislua_tosv (L, 5 );
196
+
197
+ if (argc > 4 )
198
+ background = lua_toboolean (L, 6 );
199
+
200
+ if (argc > 5 )
201
+ cacertPath = axislua_tosv (L, 7 );
202
+
203
+ auto tsk = d->createDownloadFileTask (url, storagePath, identifier, md5checksum, background, cacertPath);
190
204
191
205
pushTaskTable (L, *tsk);
192
206
return 1 ;
0 commit comments