/apps/twnlua: ctx.udata preservation (not yet for reload case)
This commit is contained in:
parent
777a06a002
commit
41d0e24780
@ -112,6 +112,12 @@ void game_tick(void) {
|
||||
State *state = ctx.udata;
|
||||
|
||||
bindgen_build_context(state->L);
|
||||
lua_getglobal(state->L, "ctx");
|
||||
if (!lua_isnoneornil(state->L, -1)) {
|
||||
lua_getfield(state->L, -1, "udata");
|
||||
lua_setfield(state->L, -3, "udata");
|
||||
}
|
||||
lua_pop(state->L, 1);
|
||||
lua_setglobal(state->L, "ctx");
|
||||
|
||||
lua_getglobal(state->L, "game_tick");
|
||||
|
Loading…
Reference in New Issue
Block a user