Add Collider:getShapes for backcompat;

This commit is contained in:
bjorn 2024-04-05 11:55:12 -07:00
parent 17fa3d1f7b
commit e2fdba6f24
1 changed files with 14 additions and 0 deletions

View File

@ -520,6 +520,16 @@ static int l_lovrColliderSetTag(lua_State* L) {
return 0;
}
// Deprecated
static int l_lovrColliderGetShapes(lua_State* L) {
Collider* collider = luax_checktype(L, 1, Collider);
Shape* shape = lovrColliderGetShape(collider);
lua_createtable(L, 1, 0);
luax_pushshape(L, shape);
lua_rawseti(L, -2, 1);
return 1;
}
const luaL_Reg lovrCollider[] = {
{ "destroy", l_lovrColliderDestroy },
{ "isDestroyed", l_lovrColliderIsDestroyed },
@ -573,5 +583,9 @@ const luaL_Reg lovrCollider[] = {
{ "setRestitution", l_lovrColliderSetRestitution },
{ "getTag", l_lovrColliderGetTag },
{ "setTag", l_lovrColliderSetTag },
// Deprecated
{ "getShapes", l_lovrColliderGetShapes },
{ NULL, NULL }
};