Fixed undefined behaviour when love exceptions are converted into Lua errors (resolves issue #729)

This commit is contained in:
Alex Szpakowski
2013-09-05 23:17:29 -03:00
parent 389e99bf2c
commit 06f80d5c08
45 changed files with 349 additions and 873 deletions
@@ -39,7 +39,7 @@ int w_ChainShape_setNextVertex(lua_State *L)
ChainShape *c = luax_checkchainshape(L, 1);
float x = (float)luaL_checknumber(L, 2);
float y = (float)luaL_checknumber(L, 3);
ASSERT_GUARD(c->setNextVertex(x, y);)
EXCEPT_GUARD(c->setNextVertex(x, y);)
return 0;
}
@@ -48,7 +48,7 @@ int w_ChainShape_setPrevVertex(lua_State *L)
ChainShape *c = luax_checkchainshape(L, 1);
float x = (float)luaL_checknumber(L, 2);
float y = (float)luaL_checknumber(L, 3);
ASSERT_GUARD(c->setPrevVertex(x, y);)
EXCEPT_GUARD(c->setPrevVertex(x, y);)
return 0;
}
@@ -64,7 +64,7 @@ int w_ChainShape_getChildEdge(lua_State *L)
ChainShape *c = luax_checkchainshape(L, 1);
int index = luaL_checkint(L, 2) - 1; // Convert from 1-based index
EdgeShape *e = 0;
ASSERT_GUARD(e = c->getChildEdge(index);)
EXCEPT_GUARD(e = c->getChildEdge(index);)
luax_pushtype(L, "EdgeShape", PHYSICS_EDGE_SHAPE_T, e);
return 1;
}
@@ -82,7 +82,7 @@ int w_ChainShape_getPoint(lua_State *L)
ChainShape *c = luax_checkchainshape(L, 1);
int index = luaL_checkint(L, 2) - 1; // Convert from 1-based index
b2Vec2 v;
ASSERT_GUARD(v = c->getPoint(index);)
EXCEPT_GUARD(v = c->getPoint(index);)
lua_pushnumber(L, v.x);
lua_pushnumber(L, v.y);
return 2;