mirror of
https://github.com/love2d/love.git
synced 2026-08-16 08:11:02 +02:00
Build type information on first use (load-time), instead of using a hardcoded list
--HG-- branch : dynamiccore2
This commit is contained in:
@@ -30,7 +30,7 @@ namespace box2d
|
||||
|
||||
Contact *luax_checkcontact(lua_State *L, int idx)
|
||||
{
|
||||
Contact *c = luax_checktype<Contact>(L, idx, PHYSICS_CONTACT_ID);
|
||||
Contact *c = luax_checktype<Contact>(L, idx, Contact::type);
|
||||
if (!c->isValid())
|
||||
luaL_error(L, "Attempt to use destroyed contact.");
|
||||
return c;
|
||||
@@ -146,14 +146,14 @@ int w_Contact_getFixtures(lua_State *L)
|
||||
Fixture *b = nullptr;
|
||||
luax_catchexcept(L, [&](){ t->getFixtures(a, b); });
|
||||
|
||||
luax_pushtype(L, PHYSICS_FIXTURE_ID, a);
|
||||
luax_pushtype(L, PHYSICS_FIXTURE_ID, b);
|
||||
luax_pushtype(L, Fixture::type, a);
|
||||
luax_pushtype(L, Fixture::type, b);
|
||||
return 2;
|
||||
}
|
||||
|
||||
int w_Contact_isDestroyed(lua_State *L)
|
||||
{
|
||||
Contact *c = luax_checktype<Contact>(L, 1, PHYSICS_CONTACT_ID);
|
||||
Contact *c = luax_checktype<Contact>(L, 1, Contact::type);
|
||||
luax_pushboolean(L, !c->isValid());
|
||||
return 1;
|
||||
}
|
||||
@@ -181,7 +181,7 @@ static const luaL_Reg w_Contact_functions[] =
|
||||
|
||||
extern "C" int luaopen_contact(lua_State *L)
|
||||
{
|
||||
return luax_register_type(L, PHYSICS_CONTACT_ID, "Contact", w_Contact_functions, nullptr);
|
||||
return luax_register_type(L, Contact::type, "Contact", w_Contact_functions, nullptr);
|
||||
}
|
||||
|
||||
} // box2d
|
||||
|
||||
Reference in New Issue
Block a user