Skip to content

Commit 529f999

Browse files
committed
fix hook
1 parent f9bc475 commit 529f999

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

core/src/xmake/engine.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1434,13 +1434,12 @@ xm_engine_ref_t xm_engine_init(tb_char_t const* name, xm_engine_lni_initalizer_c
14341434
tb_strlcpy(engine->name, name, sizeof(engine->name));
14351435

14361436
// init lua
1437-
engine->lua = luaL_newstate();
1438-
tb_assert_and_check_break(engine->lua);
1439-
14401437
#if XM_HOOK_LUA_MEMALLOC
1441-
// hook lua memmory, @note we cannot set udata argument, xm_engine_bind_to_lua() has used it.
1442-
lua_setallocf(engine->lua, xm_engine_lua_realloc, tb_null);
1438+
engine->lua = lua_newstate(xm_engine_lua_realloc, tb_null);
1439+
#else
1440+
engine->lua = luaL_newstate();
14431441
#endif
1442+
tb_assert_and_check_break(engine->lua);
14441443

14451444
// open lua libraries
14461445
luaL_openlibs(engine->lua);

0 commit comments

Comments
 (0)