diff options
| author | ruki <[email protected]> | 2020-04-26 11:44:24 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-04-26 11:44:24 +0800 |
| commit | d4f19159a6e63cfbb879bc1f9e9ed3de3eb05d0e (patch) | |
| tree | a98d9fc630055c71a727af7a5218007b0cf2ca6d /core/src | |
| parent | 08b8050316bf8af82e6c6a2ed30b9bd03b4983f0 (diff) | |
fix engine argv
Diffstat (limited to 'core/src')
| -rw-r--r-- | core/src/xmake/engine.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/core/src/xmake/engine.c b/core/src/xmake/engine.c index a90890414..440b17623 100644 --- a/core/src/xmake/engine.c +++ b/core/src/xmake/engine.c @@ -395,7 +395,19 @@ static tb_bool_t xm_engine_save_arguments(xm_engine_t* engine, tb_int_t argc, tb #endif // put a new table into the stack - lua_createtable(engine->lua, argc, 0); + lua_newtable(engine->lua); + + // patch the task arguments list + if (taskargv) + { + tb_char_t** taskarg = taskargv; + while (*taskarg) + { + lua_pushstring(engine->lua, *taskarg); + lua_rawseti(engine->lua, -2, (int)lua_objlen(engine->lua, -2) + 1); + taskarg++; + } + } // save all arguments to the new table tb_int_t i = 0; @@ -410,18 +422,6 @@ static tb_bool_t xm_engine_save_arguments(xm_engine_t* engine, tb_int_t argc, tb lua_pushstring(engine->lua, argv[i]); #endif lua_rawseti(engine->lua, -2, (int)lua_objlen(engine->lua, -2) + 1); - - // patch the task arguments list - if (taskargv && i == 1) - { - tb_char_t** taskarg = taskargv; - while (*taskarg) - { - lua_pushstring(engine->lua, *taskarg); - lua_rawseti(engine->lua, -2, (int)lua_objlen(engine->lua, -2) + 1); - taskarg++; - } - } } // _ARGV = table_new |
