fixed bug popping when i shouldnt have been and registering doPhysics()

git-svn-id: svn://anubis/anaglym/trunk@49 99a6e188-d820-4881-8870-2d33a10e2619
This commit is contained in:
Josh Holtrop 2009-10-05 19:44:55 +00:00
parent 6a52215247
commit 4b34a2e565
2 changed files with 7 additions and 2 deletions

1
ag.cc
View File

@ -29,6 +29,7 @@ namespace ag
{ "endFrame", endFrame },
{ "setCamera", setCamera },
{ "elapsedTime", elapsedTime },
{ "doPhysics", doPhysics },
{ NULL, NULL }
};
luaL_register(L, "ag", functions);

View File

@ -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);
}
else
{
lua_pop(m_luaState, 1);
}
m_drawing = false;
}