Replaced the EXCEPT_GUARD macro for converting love exceptions into Lua errors with the new luax_catchexcept function, which takes lambda function arguments.

This commit is contained in:
Alex Szpakowski
2014-06-03 19:27:00 -03:00
parent 724bdbd296
commit dfa319e01a
45 changed files with 315 additions and 227 deletions
+4 -4
View File
@@ -49,7 +49,7 @@ int w_randomNormal(lua_State *L)
int w_setRandomSeed(lua_State *L)
{
EXCEPT_GUARD(Math::instance.setRandomSeed(luax_checkrandomseed(L, 1));)
luax_catchexcept(L, [&](){ Math::instance.setRandomSeed(luax_checkrandomseed(L, 1)); });
return 0;
}
@@ -63,7 +63,7 @@ int w_getRandomSeed(lua_State *L)
int w_setRandomState(lua_State *L)
{
EXCEPT_GUARD(Math::instance.setRandomState(luax_checkstring(L, 1));)
luax_catchexcept(L, [&](){ Math::instance.setRandomState(luax_checkstring(L, 1)); });
return 0;
}
@@ -180,12 +180,12 @@ int w_triangulate(lua_State *L)
std::vector<Triangle> triangles;
EXCEPT_GUARD(
luax_catchexcept(L, [&]() {
if (vertices.size() == 3)
triangles.push_back(Triangle(vertices[0], vertices[1], vertices[2]));
else
triangles = Math::instance.triangulate(vertices);
)
});
lua_createtable(L, triangles.size(), 0);
for (size_t i = 0; i < triangles.size(); ++i)