Register composed structs with luabridge

41 views Asked by At

I've the following GlobalStruct struct that I want to parse from a lua table:

namespace N1 {
struct DetailedStruct {
  int i1;
  int i2;
};
}

namespace N2 {
struct GlobalStruct {
  int i1;
  N1::DetailedStruct ds1;
}
}

With luabridge3 how can I register the DetailedStruct attribute?

luabridge::getGlobalNamespace(L)
  .beginClass<N2::GlobalStruct >("N2_GlobalStruct ")
  .addConstructor<void (*) (void)>()
  .addProperty("i1", &N2::GlobalStruct::i1)
  // register ds1 attribute?
  .endClass();

I can use .addProperty for registering i1 attribute, but I don't know how to add ds1 property that's of type N1::DetailedStruct (another struct in another namespace).

What should I do?

0

There are 0 answers