Functions that take a boolean argument now properly type-check for it.

--HG--
branch : minor
This commit is contained in:
Alex Szpakowski
2017-08-14 22:56:20 -03:00
parent fea9f82cfa
commit fee157b6b9
21 changed files with 50 additions and 42 deletions
+1 -1
View File
@@ -164,7 +164,7 @@ int Physics::newChainShape(lua_State *L)
return luaL_error(L, "Number of vertex components must be a multiple of two.");
int vcount = argc/2;
bool loop = luax_toboolean(L, 1);
bool loop = luax_checkboolean(L, 1);
b2Vec2 *vecs = new b2Vec2[vcount];
if (istable)
+5 -5
View File
@@ -456,7 +456,7 @@ int w_Body_isBullet(lua_State *L)
int w_Body_setBullet(lua_State *L)
{
Body *t = luax_checkbody(L, 1);
bool b = luax_toboolean(L, 2);
bool b = luax_checkboolean(L, 2);
t->setBullet(b);
return 0;
}
@@ -478,7 +478,7 @@ int w_Body_isAwake(lua_State *L)
int w_Body_setSleepingAllowed(lua_State *L)
{
Body *t = luax_checkbody(L, 1);
bool b = luax_toboolean(L, 2);
bool b = luax_checkboolean(L, 2);
t->setSleepingAllowed(b);
return 0;
}
@@ -493,7 +493,7 @@ int w_Body_isSleepingAllowed(lua_State *L)
int w_Body_setActive(lua_State *L)
{
Body *t = luax_checkbody(L, 1);
bool b = luax_toboolean(L, 2);
bool b = luax_checkboolean(L, 2);
luax_catchexcept(L, [&](){ t->setActive(b); });
return 0;
}
@@ -501,7 +501,7 @@ int w_Body_setActive(lua_State *L)
int w_Body_setAwake(lua_State *L)
{
Body *t = luax_checkbody(L, 1);
bool b = luax_toboolean(L, 2);
bool b = luax_checkboolean(L, 2);
t->setAwake(b);
return 0;
}
@@ -509,7 +509,7 @@ int w_Body_setAwake(lua_State *L)
int w_Body_setFixedRotation(lua_State *L)
{
Body *t = luax_checkbody(L, 1);
bool b = luax_toboolean(L, 2);
bool b = luax_checkboolean(L, 2);
luax_catchexcept(L, [&](){ t->setFixedRotation(b); });
return 0;
}
+1 -1
View File
@@ -95,7 +95,7 @@ int w_Contact_setRestitution(lua_State *L)
int w_Contact_setEnabled(lua_State *L)
{
Contact *t = luax_checkcontact(L, 1);
bool e = luax_toboolean(L, 2);
bool e = luax_checkboolean(L, 2);
t->setEnabled(e);
return 0;
}
+1 -1
View File
@@ -72,7 +72,7 @@ int w_Fixture_setDensity(lua_State *L)
int w_Fixture_setSensor(lua_State *L)
{
Fixture *t = luax_checkfixture(L, 1);
bool arg1 = luax_toboolean(L, 2);
bool arg1 = luax_checkboolean(L, 2);
t->setSensor(arg1);
return 0;
}
@@ -53,7 +53,7 @@ int w_PrismaticJoint_getJointSpeed(lua_State *L)
int w_PrismaticJoint_setMotorEnabled(lua_State *L)
{
PrismaticJoint *t = luax_checkprismaticjoint(L, 1);
bool arg1 = luax_toboolean(L, 2);
bool arg1 = luax_checkboolean(L, 2);
t->setMotorEnabled(arg1);
return 0;
}
@@ -106,7 +106,7 @@ int w_PrismaticJoint_getMaxMotorForce(lua_State *L)
int w_PrismaticJoint_setLimitsEnabled(lua_State *L)
{
PrismaticJoint *t = luax_checkprismaticjoint(L, 1);
bool arg1 = luax_toboolean(L, 2);
bool arg1 = luax_checkboolean(L, 2);
t->setLimitsEnabled(arg1);
return 0;
}
@@ -53,7 +53,7 @@ int w_RevoluteJoint_getJointSpeed(lua_State *L)
int w_RevoluteJoint_setMotorEnabled(lua_State *L)
{
RevoluteJoint *t = luax_checkrevolutejoint(L, 1);
bool arg1 = luax_toboolean(L, 2);
bool arg1 = luax_checkboolean(L, 2);
t->setMotorEnabled(arg1);
return 0;
}
@@ -106,7 +106,7 @@ int w_RevoluteJoint_getMaxMotorTorque(lua_State *L)
int w_RevoluteJoint_setLimitsEnabled(lua_State *L)
{
RevoluteJoint *t = luax_checkrevolutejoint(L, 1);
bool arg1 = luax_toboolean(L, 2);
bool arg1 = luax_checkboolean(L, 2);
t->setLimitsEnabled(arg1);
return 0;
}
@@ -52,7 +52,7 @@ int w_WheelJoint_getJointSpeed(lua_State *L)
int w_WheelJoint_setMotorEnabled(lua_State *L)
{
WheelJoint *t = luax_checkwheeljoint(L, 1);
bool arg1 = luax_toboolean(L, 2);
bool arg1 = luax_checkboolean(L, 2);
t->setMotorEnabled(arg1);
return 0;
}
+1 -1
View File
@@ -111,7 +111,7 @@ int w_World_translateOrigin(lua_State *L)
int w_World_setSleepingAllowed(lua_State *L)
{
World *t = luax_checkworld(L, 1);
bool b = luax_toboolean(L, 2);
bool b = luax_checkboolean(L, 2);
t->setSleepingAllowed(b);
return 0;
}