diff --git a/ag.cc b/ag.cc index 3f6f7b0..52990e7 100644 --- a/ag.cc +++ b/ag.cc @@ -29,6 +29,7 @@ namespace ag { "endFrame", endFrame }, { "setCamera", setCamera }, { "elapsedTime", elapsedTime }, + { "doPhysics", doPhysics }, { NULL, NULL } }; luaL_register(L, "ag", functions); diff --git a/anaglym.cc b/anaglym.cc index 4da1353..6997bba 100644 --- a/anaglym.cc +++ b/anaglym.cc @@ -303,10 +303,14 @@ void Engine::update() lua_getfield(m_luaState, LUA_GLOBALSINDEX, "update"); if (lua_type(m_luaState, -1) == LUA_TFUNCTION) { - int s = lua_pcall(m_luaState, 0, 0, 0); + /* call the update function - pops the function ref from the stack */ + int s = lua_pcall(m_luaState, 0, LUA_MULTRET, 0); reportErrors(s); } - lua_pop(m_luaState, 1); + else + { + lua_pop(m_luaState, 1); + } m_drawing = false; }