summaryrefslogtreecommitdiff
path: root/core/src/xmake/engine.c
diff options
context:
space:
mode:
authorruki <[email protected]>2024-04-05 16:21:00 +0800
committerGitHub <[email protected]>2024-04-05 16:21:00 +0800
commit982a307fa363ae022554df2afaa3f922c5bb0986 (patch)
tree279590bb6068b94eeade11693217b11d21e0db35 /core/src/xmake/engine.c
parent282e468d6cf18473bac127d260fe802e7bb64392 (diff)
parent5297e2329198a683400870382699af2f37d25ec2 (diff)
Merge pull request #4932 from xmake-io/native
Improve native shared module to remove lua package dependence
Diffstat (limited to 'core/src/xmake/engine.c')
-rw-r--r--core/src/xmake/engine.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/core/src/xmake/engine.c b/core/src/xmake/engine.c
index 827d46d2e..b63dcf42b 100644
--- a/core/src/xmake/engine.c
+++ b/core/src/xmake/engine.c
@@ -294,6 +294,9 @@ tb_int_t xm_libc_setbyte(lua_State* lua);
// the tty functions
tb_int_t xm_tty_term_mode(lua_State* lua);
+// the package functions
+tb_int_t xm_package_loadxmi(lua_State* lua);
+
#ifdef XM_CONFIG_API_HAVE_CURSES
// register curses functions
tb_int_t xm_lua_curses_register(lua_State* lua, tb_char_t const* module);
@@ -571,6 +574,13 @@ static luaL_Reg const g_tty_functions[] =
, { tb_null, tb_null }
};
+// the package functions
+static luaL_Reg const g_package_functions[] =
+{
+ { "loadxmi", xm_package_loadxmi }
+, { tb_null, tb_null }
+};
+
// the lua global instance for signal handler
static lua_State* g_lua = tb_null;
@@ -1158,6 +1168,9 @@ xm_engine_ref_t xm_engine_init(tb_char_t const* name, xm_engine_lni_initalizer_c
// bind tty functions
xm_lua_register(engine->lua, "tty", g_tty_functions);
+ // bind package functions
+ xm_lua_register(engine->lua, "package", g_package_functions);
+
#ifdef XM_CONFIG_API_HAVE_CURSES
// bind curses
xm_lua_curses_register(engine->lua, "curses");