make love.physics.setMeter error on invalid meters (anything less than 1)

--HG--
branch : box2d-update
This commit is contained in:
Bill Meltsner
2011-10-02 09:33:42 -04:00
parent ffef6f58a9
commit 735c52b228
2 changed files with 6 additions and 1 deletions
+1
View File
@@ -234,6 +234,7 @@ namespace box2d
void Physics::setMeter(int meter)
{
if (meter < 1) throw love::Exception("Physics error: invalid meter");
Physics::meter = meter;
}
+5 -1
View File
@@ -304,7 +304,11 @@ namespace box2d
int w_setMeter(lua_State * L)
{
int arg1 = luaL_checkint(L, 1);
Physics::setMeter(arg1);
try {
Physics::setMeter(arg1);
} catch (love::Exception e) {
return luaL_error(L, e.what());
}
return 0;
}