mirror of
https://github.com/love2d/love.git
synced 2026-08-15 07:41:11 +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:
@@ -62,7 +62,7 @@ int w_ImageData_getPixel(lua_State *L)
|
||||
int y = luaL_checkint(L, 3);
|
||||
pixel c;
|
||||
|
||||
EXCEPT_GUARD(c = t->getPixel(x, y);)
|
||||
luax_catchexcept(L, [&](){ c = t->getPixel(x, y); });
|
||||
|
||||
lua_pushnumber(L, c.r);
|
||||
lua_pushnumber(L, c.g);
|
||||
@@ -98,7 +98,7 @@ int w_ImageData_setPixel(lua_State *L)
|
||||
c.a = (unsigned char)luaL_optinteger(L, 7, 255);
|
||||
}
|
||||
|
||||
EXCEPT_GUARD(t->setPixel(x, y, c);)
|
||||
luax_catchexcept(L, [&](){ t->setPixel(x, y, c); });
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -261,7 +261,7 @@ int w_ImageData_encode(lua_State *L)
|
||||
return luaL_error(L, "Invalid image format '%s'.", fmt);
|
||||
}
|
||||
|
||||
EXCEPT_GUARD(t->encode(file, format);)
|
||||
luax_catchexcept(L, [&](){ t->encode(file, format); });
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user