How to clone b2Shape* object without b2ShapeDef copy

Hi All.
I use Lua binding for scripting game levels.

Thats example:

Code:

// LUA binders
void ScriptBinderPushData(void*);
void* ScriptBinderPopData();

void BindToLua()
{
// set body_def and shape_def structures data
b2BodyDef body_def;
b2ShapeDef shape_def;
// create body and shape
b2Body* src_body = CreateBody(&body_def);
CreateShape(&shape_def);
// push b2Body object pointer to script mashine
LuaBinderPushData(src_body);
}

void FromLuaBinder()
{
// get b2Body object pointer from script mashine
b2Body* src_body = NULL;
src_body = (b2Body*)LuaBinderPopData();
// To create body clone need b2BodyDef and b2ShapeDef objects.
b2BodyDef unknownBodyDef;
b2ShapeDef unknownShapeDef;

//
// Here i need to set unknownBodyDef and unknownShapeDef structures same as src_body object has;
// How to do this ?
//

b2Body* body_clone = CreateBody(&unknownBodyDef);
b2Shape* shape_clone = CreateShape(&nknownShapeDef);
}



So I has only b2Shape and b2Body object pointers (and not b2ShapeDef and b2BodyDef items). And how to create b2Shape and b2Body objects copies?

Thanks!
Box2D works on the factory design method, you are going to need the *def creation functions to design and create new shapes and bodies.

Original thread: https://box2d.org/forum/viewtopic.php?t=3093