Automatically deduce the type in luax_checktype, luax_getmodule, luax_optmodule and luax_totype

--HG--
branch : dynamiccore2
This commit is contained in:
Bart van Strien
2016-11-13 17:13:40 +01:00
parent 4a0a90e511
commit 7dd960619d
61 changed files with 120 additions and 98 deletions
+2 -2
View File
@@ -296,8 +296,8 @@ Fixture *Physics::newFixture(Body *body, Shape *shape, float density)
int Physics::getDistance(lua_State *L)
{
Fixture *fixtureA = luax_checktype<Fixture>(L, 1, Fixture::type);
Fixture *fixtureB = luax_checktype<Fixture>(L, 2, Fixture::type);
Fixture *fixtureA = luax_checktype<Fixture>(L, 1);
Fixture *fixtureB = luax_checktype<Fixture>(L, 2);
b2DistanceProxy pA, pB;
b2DistanceInput i;
b2DistanceOutput o;
+2 -2
View File
@@ -30,7 +30,7 @@ namespace box2d
Body *luax_checkbody(lua_State *L, int idx)
{
Body *b = luax_checktype<Body>(L, idx, Body::type);
Body *b = luax_checktype<Body>(L, idx);
if (b->body == 0)
luaL_error(L, "Attempt to use destroyed body.");
return b;
@@ -566,7 +566,7 @@ int w_Body_destroy(lua_State *L)
int w_Body_isDestroyed(lua_State *L)
{
Body *b = luax_checktype<Body>(L, 1, Body::type);
Body *b = luax_checktype<Body>(L, 1);
luax_pushboolean(L, b->body == nullptr);
return 1;
}
@@ -31,7 +31,7 @@ namespace box2d
ChainShape *luax_checkchainshape(lua_State *L, int idx)
{
return luax_checktype<ChainShape>(L, idx, ChainShape::type);
return luax_checktype<ChainShape>(L, idx);
}
int w_ChainShape_setNextVertex(lua_State *L)
@@ -29,7 +29,7 @@ namespace box2d
CircleShape *luax_checkcircleshape(lua_State *L, int idx)
{
return luax_checktype<CircleShape>(L, idx, CircleShape::type);
return luax_checktype<CircleShape>(L, idx);
}
int w_CircleShape_getRadius(lua_State *L)
+2 -2
View File
@@ -30,7 +30,7 @@ namespace box2d
Contact *luax_checkcontact(lua_State *L, int idx)
{
Contact *c = luax_checktype<Contact>(L, idx, Contact::type);
Contact *c = luax_checktype<Contact>(L, idx);
if (!c->isValid())
luaL_error(L, "Attempt to use destroyed contact.");
return c;
@@ -153,7 +153,7 @@ int w_Contact_getFixtures(lua_State *L)
int w_Contact_isDestroyed(lua_State *L)
{
Contact *c = luax_checktype<Contact>(L, 1, Contact::type);
Contact *c = luax_checktype<Contact>(L, 1);
luax_pushboolean(L, !c->isValid());
return 1;
}
@@ -29,7 +29,7 @@ namespace box2d
DistanceJoint *luax_checkdistancejoint(lua_State *L, int idx)
{
DistanceJoint *j = luax_checktype<DistanceJoint>(L, idx, DistanceJoint::type);
DistanceJoint *j = luax_checktype<DistanceJoint>(L, idx);
if (!j->isValid())
luaL_error(L, "Attempt to use destroyed joint.");
return j;
+1 -1
View File
@@ -29,7 +29,7 @@ namespace box2d
EdgeShape *luax_checkedgeshape(lua_State *L, int idx)
{
return luax_checktype<EdgeShape>(L, idx, EdgeShape::type);
return luax_checktype<EdgeShape>(L, idx);
}
int w_EdgeShape_setNextVertex(lua_State *L)
+2 -2
View File
@@ -30,7 +30,7 @@ namespace box2d
Fixture *luax_checkfixture(lua_State *L, int idx)
{
Fixture *f = luax_checktype<Fixture>(L, idx, Fixture::type);
Fixture *f = luax_checktype<Fixture>(L, idx);
if (!f->isValid())
luaL_error(L, "Attempt to use destroyed fixture.");
return f;
@@ -263,7 +263,7 @@ int w_Fixture_destroy(lua_State *L)
int w_Fixture_isDestroyed(lua_State *L)
{
Fixture *f = luax_checktype<Fixture>(L, 1, Fixture::type);
Fixture *f = luax_checktype<Fixture>(L, 1);
luax_pushboolean(L, !f->isValid());
return 1;
}
@@ -30,7 +30,7 @@ namespace box2d
FrictionJoint *luax_checkfrictionjoint(lua_State *L, int idx)
{
FrictionJoint *j = luax_checktype<FrictionJoint>(L, idx, FrictionJoint::type);
FrictionJoint *j = luax_checktype<FrictionJoint>(L, idx);
if (!j->isValid())
luaL_error(L, "Attempt to use destroyed joint.");
return j;
+1 -1
View File
@@ -30,7 +30,7 @@ namespace box2d
GearJoint *luax_checkgearjoint(lua_State *L, int idx)
{
GearJoint *j = luax_checktype<GearJoint>(L, idx, GearJoint::type);
GearJoint *j = luax_checktype<GearJoint>(L, idx);
if (!j->isValid())
luaL_error(L, "Attempt to use destroyed joint.");
return j;
+2 -2
View File
@@ -77,7 +77,7 @@ void luax_pushjoint(lua_State *L, Joint *j)
Joint *luax_checkjoint(lua_State *L, int idx)
{
Joint *t = luax_checktype<Joint>(L, idx, Joint::type);
Joint *t = luax_checktype<Joint>(L, idx);
if (!t->isValid())
luaL_error(L, "Attempt to use destroyed joint.");
return t;
@@ -160,7 +160,7 @@ int w_Joint_destroy(lua_State *L)
int w_Joint_isDestroyed(lua_State *L)
{
Joint *t = luax_checktype<Joint>(L, 1, Joint::type);
Joint *t = luax_checktype<Joint>(L, 1);
luax_pushboolean(L, !t->isValid());
return 1;
}
@@ -29,7 +29,7 @@ namespace box2d
MotorJoint *luax_checkmotorjoint(lua_State *L, int idx)
{
MotorJoint *j = luax_checktype<MotorJoint>(L, idx, MotorJoint::type);
MotorJoint *j = luax_checktype<MotorJoint>(L, idx);
if (!j->isValid())
luaL_error(L, "Attempt to use destroyed joint.");
return j;
@@ -29,7 +29,7 @@ namespace box2d
MouseJoint *luax_checkmousejoint(lua_State *L, int idx)
{
MouseJoint *j = luax_checktype<MouseJoint>(L, idx, MouseJoint::type);
MouseJoint *j = luax_checktype<MouseJoint>(L, idx);
if (!j->isValid())
luaL_error(L, "Attempt to use destroyed joint.");
return j;
@@ -29,7 +29,7 @@ namespace box2d
PolygonShape *luax_checkpolygonshape(lua_State *L, int idx)
{
return luax_checktype<PolygonShape>(L, idx, PolygonShape::type);
return luax_checktype<PolygonShape>(L, idx);
}
int w_PolygonShape_getPoints(lua_State *L)
@@ -30,7 +30,7 @@ namespace box2d
PrismaticJoint *luax_checkprismaticjoint(lua_State *L, int idx)
{
PrismaticJoint *j = luax_checktype<PrismaticJoint>(L, idx, PrismaticJoint::type);
PrismaticJoint *j = luax_checktype<PrismaticJoint>(L, idx);
if (!j->isValid())
luaL_error(L, "Attempt to use destroyed joint.");
return j;
@@ -29,7 +29,7 @@ namespace box2d
PulleyJoint *luax_checkpulleyjoint(lua_State *L, int idx)
{
PulleyJoint *j = luax_checktype<PulleyJoint>(L, idx, PulleyJoint::type);
PulleyJoint *j = luax_checktype<PulleyJoint>(L, idx);
if (!j->isValid())
luaL_error(L, "Attempt to use destroyed joint.");
return j;
@@ -30,7 +30,7 @@ namespace box2d
RevoluteJoint *luax_checkrevolutejoint(lua_State *L, int idx)
{
RevoluteJoint *j = luax_checktype<RevoluteJoint>(L, idx, RevoluteJoint::type);
RevoluteJoint *j = luax_checktype<RevoluteJoint>(L, idx);
if (!j->isValid())
luaL_error(L, "Attempt to use destroyed joint.");
return j;
+1 -1
View File
@@ -29,7 +29,7 @@ namespace box2d
RopeJoint *luax_checkropejoint(lua_State *L, int idx)
{
RopeJoint *j = luax_checktype<RopeJoint>(L, idx, RopeJoint::type);
RopeJoint *j = luax_checktype<RopeJoint>(L, idx);
if (!j->isValid())
luaL_error(L, "Attempt to use destroyed joint.");
return j;
+1 -1
View File
@@ -30,7 +30,7 @@ namespace box2d
Shape *luax_checkshape(lua_State *L, int idx)
{
return luax_checktype<Shape>(L, idx, Shape::type);
return luax_checktype<Shape>(L, idx);
}
int w_Shape_getType(lua_State *L)
+1 -1
View File
@@ -29,7 +29,7 @@ namespace box2d
WeldJoint *luax_checkweldjoint(lua_State *L, int idx)
{
WeldJoint *j = luax_checktype<WeldJoint>(L, idx, WeldJoint::type);
WeldJoint *j = luax_checktype<WeldJoint>(L, idx);
if (!j->isValid())
luaL_error(L, "Attempt to use destroyed joint.");
return j;
@@ -29,7 +29,7 @@ namespace box2d
WheelJoint *luax_checkwheeljoint(lua_State *L, int idx)
{
WheelJoint *j = luax_checktype<WheelJoint>(L, idx, WheelJoint::type);
WheelJoint *j = luax_checktype<WheelJoint>(L, idx);
if (!j->isValid())
luaL_error(L, "Attempt to use destroyed joint.");
return j;
+2 -2
View File
@@ -29,7 +29,7 @@ namespace box2d
World *luax_checkworld(lua_State *L, int idx)
{
World *w = luax_checktype<World>(L, idx, World::type);
World *w = luax_checktype<World>(L, idx);
if (!w->isValid())
luaL_error(L, "Attempt to use destroyed world.");
return w;
@@ -203,7 +203,7 @@ int w_World_destroy(lua_State *L)
int w_World_isDestroyed(lua_State *L)
{
World *w = luax_checktype<World>(L, 1, World::type);
World *w = luax_checktype<World>(L, 1);
luax_pushboolean(L, !w->isValid());
return 1;
}