/apps/twnlua: expose ctx

This commit is contained in:
veclavtalica
2025-01-11 16:01:41 +03:00
parent 313108092b
commit 777a06a002
3 changed files with 93 additions and 57 deletions

View File

@ -13,6 +13,7 @@
/* generated by bindgen.py */
void bindgen_load_twn(lua_State *L);
void bindgen_unload_twn(lua_State *L);
void bindgen_build_context(lua_State *L);
/* require will go through physicsfs exclusively so that scripts can be in the data dir */
@ -110,6 +111,9 @@ void game_tick(void) {
State *state = ctx.udata;
bindgen_build_context(state->L);
lua_setglobal(state->L, "ctx");
lua_getglobal(state->L, "game_tick");
if (lua_pcall(state->L, 0, 0, 0) != LUA_OK) {
log_critical("%s", lua_tostring(state->L, -1));