From 4b34a2e56584bd480a4534726a7c57b6c2c35eac Mon Sep 17 00:00:00 2001 From: Josh Holtrop Date: Mon, 5 Oct 2009 19:44:55 +0000 Subject: [PATCH] fixed bug popping when i shouldnt have been and registering doPhysics() git-svn-id: svn://anubis/anaglym/trunk@49 99a6e188-d820-4881-8870-2d33a10e2619 --- ag.cc | 1 + anaglym.cc | 8 ++++++-- 2 files changed, 7 insertions(+), 2 deletions(-) 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; }