diff options
| author | ruki <[email protected]> | 2025-09-21 20:50:31 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2025-09-21 20:50:31 +0800 |
| commit | 529f9991b0335ce0c583f873bf59721009cf71a8 (patch) | |
| tree | 7cab5e58fcedaaae9dfaaa8a800d41ec0258dd34 | |
| parent | f9bc475a5ba47b954d23d16c71a4b6bbd4cb6ca4 (diff) | |
fix hook
| -rw-r--r-- | core/src/xmake/engine.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/core/src/xmake/engine.c b/core/src/xmake/engine.c index f720e29f4..203fc1d49 100644 --- a/core/src/xmake/engine.c +++ b/core/src/xmake/engine.c @@ -1434,13 +1434,12 @@ xm_engine_ref_t xm_engine_init(tb_char_t const* name, xm_engine_lni_initalizer_c tb_strlcpy(engine->name, name, sizeof(engine->name)); // init lua - engine->lua = luaL_newstate(); - tb_assert_and_check_break(engine->lua); - #if XM_HOOK_LUA_MEMALLOC - // hook lua memmory, @note we cannot set udata argument, xm_engine_bind_to_lua() has used it. - lua_setallocf(engine->lua, xm_engine_lua_realloc, tb_null); + engine->lua = lua_newstate(xm_engine_lua_realloc, tb_null); +#else + engine->lua = luaL_newstate(); #endif + tb_assert_and_check_break(engine->lua); // open lua libraries luaL_openlibs(engine->lua); |
