diff options
| author | ruki <[email protected]> | 2020-04-22 23:44:03 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2020-04-22 16:24:20 +0800 |
| commit | 05df31effcfc9bc701387e1383b678f0914241be (patch) | |
| tree | ad03fc1658358ed939e1bb479289f4a3e9515130 /tests/projects/xmake_cli/hello/src | |
| parent | a69f20d2daf4ed61b58b036eee7bf20a3034a30e (diff) | |
improve engine
Diffstat (limited to 'tests/projects/xmake_cli/hello/src')
| -rw-r--r-- | tests/projects/xmake_cli/hello/src/lni/main.c | 32 | ||||
| -rw-r--r-- | tests/projects/xmake_cli/hello/src/lua/main.lua | 5 |
2 files changed, 6 insertions, 31 deletions
diff --git a/tests/projects/xmake_cli/hello/src/lni/main.c b/tests/projects/xmake_cli/hello/src/lni/main.c index a2601687a..d1ab0b0fb 100644 --- a/tests/projects/xmake_cli/hello/src/lni/main.c +++ b/tests/projects/xmake_cli/hello/src/lni/main.c @@ -16,34 +16,10 @@ static tb_void_t lni_initalizer(xm_engine_ref_t engine, lua_State* lua) } tb_int_t main(tb_int_t argc, tb_char_t** argv) { - tb_int_t ok = -1; - if (xm_init()) - { - xm_engine_ref_t engine = xm_engine_init(lni_initalizer); - if (engine) - { -#if 0 - tb_int_t argc2 = argc + 2; - tb_char_t* argv2[argc2 + 1]; - argv2[0] = argv[0]; - argv2[1] = "lua"; - argv2[2] = "lua.main"; - if (argc > 1) tb_memcpy(argv2 + 3, argv + 1, (argc - 1) * sizeof(tb_char_t*)); - argv2[argc2] = tb_null; +#ifdef __tb_debug__ + tb_char_t const* luaopts = "-vD"; #else - tb_int_t argc2 = argc + 3; - tb_char_t* argv2[argc2 + 1]; - argv2[0] = argv[0]; - argv2[1] = "lua"; - argv2[2] = "-vD"; - argv2[3] = "lua.main"; - if (argc > 1) tb_memcpy(argv2 + 4, argv + 1, (argc - 1) * sizeof(tb_char_t*)); - argv2[argc2] = tb_null; + tb_char_t const* luaopts = "-D"; #endif - ok = xm_engine_main(engine, argc2, argv2); - xm_engine_exit(engine); - } - xm_exit(); - } - return ok; + return xm_engine_run_lua(argc, argv, lni_initalizer, luaopts); } diff --git a/tests/projects/xmake_cli/hello/src/lua/main.lua b/tests/projects/xmake_cli/hello/src/lua/main.lua index 0a1590543..d87daf102 100644 --- a/tests/projects/xmake_cli/hello/src/lua/main.lua +++ b/tests/projects/xmake_cli/hello/src/lua/main.lua @@ -1,9 +1,8 @@ import("core.base.option") -import("lib.lni") +import("lib.lni.test") function main () - print(lni) - print("hello xmake!") + print(test.hello()) local argv = option.get("arguments") if argv then print(argv) |
