diff options
Diffstat (limited to 'tests/projects/xmake_cli/hello/src')
| -rw-r--r-- | tests/projects/xmake_cli/hello/src/lni/main.c | 16 | ||||
| -rw-r--r-- | tests/projects/xmake_cli/hello/src/lua/main.lua | 3 |
2 files changed, 18 insertions, 1 deletions
diff --git a/tests/projects/xmake_cli/hello/src/lni/main.c b/tests/projects/xmake_cli/hello/src/lni/main.c index dfef99794..1d574dc1b 100644 --- a/tests/projects/xmake_cli/hello/src/lni/main.c +++ b/tests/projects/xmake_cli/hello/src/lni/main.c @@ -1,11 +1,25 @@ #include <xmake/xmake.h> +static tb_int_t lni_test_hello(lua_State* lua) +{ + lua_pushliteral(lua, "hello xmake!"); + return 1; +} +static tb_void_t lni_initalizer(xm_engine_ref_t engine, lua_State* lua) +{ + static luaL_Reg const lni_test_funcs[] = + { + {"hello", lni_test_hello} + , {tb_null, tb_null} + }; + xm_engine_register(engine, "test", lni_test_funcs); +} 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(tb_null); + xm_engine_ref_t engine = xm_engine_init(lni_initalizer); if (engine) { tb_int_t argc2 = argc + 2; diff --git a/tests/projects/xmake_cli/hello/src/lua/main.lua b/tests/projects/xmake_cli/hello/src/lua/main.lua index 1ce83e728..26ba586a2 100644 --- a/tests/projects/xmake_cli/hello/src/lua/main.lua +++ b/tests/projects/xmake_cli/hello/src/lua/main.lua @@ -1,5 +1,8 @@ import("core.base.option") +import("lib.lni.test") + function main () + print(test) print("hello xmake!") local argv = option.get("arguments") if argv then |
