mirror of
https://github.com/love2d/love.git
synced 2026-08-20 20:49:54 +02:00
make love.physics.setMeter error on invalid meters (anything less than 1)
--HG-- branch : box2d-update
This commit is contained in:
@@ -234,6 +234,7 @@ namespace box2d
|
|||||||
|
|
||||||
void Physics::setMeter(int meter)
|
void Physics::setMeter(int meter)
|
||||||
{
|
{
|
||||||
|
if (meter < 1) throw love::Exception("Physics error: invalid meter");
|
||||||
Physics::meter = meter;
|
Physics::meter = meter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -304,7 +304,11 @@ namespace box2d
|
|||||||
int w_setMeter(lua_State * L)
|
int w_setMeter(lua_State * L)
|
||||||
{
|
{
|
||||||
int arg1 = luaL_checkint(L, 1);
|
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;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user