mirror of
https://github.com/love2d/love.git
synced 2026-08-12 08:30:56 +02:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user