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
+3 -3
View File
@@ -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;
}