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
+5 -5
View File
@@ -232,10 +232,10 @@ int w_Shader_sendMatrix(lua_State *L)
lua_pop(L, 1 + dimension);
}
EXCEPT_GUARD_FINALLY(
{ shader->sendMatrix(name, dimension, values, count); },
{ delete[] values; }
)
luax_catchexcept(L,
[&]() { shader->sendMatrix(name, dimension, values, count); },
[&]() { delete[] values; }
);
return 0;
}
@@ -246,7 +246,7 @@ int w_Shader_sendTexture(lua_State *L)
const char *name = luaL_checkstring(L, 2);
Texture *texture = luax_checktexture(L, 3);
EXCEPT_GUARD(shader->sendTexture(name, texture);)
luax_catchexcept(L, [&](){ shader->sendTexture(name, texture); });
return 0;
}