flatbuffers: Using add_myTable(table) to encode data

83 Views Asked by At

I am trying to use the following method of building a table, as taken from the flatbuffers tutorial:

MonsterBuilder monster_builder(builder);
monster_builder.add_pos(&pos);
monster_builder.add_hp(hp);

But having done this for my root table I am unsure if I need to call .Finish() before adding it to the table that then contains the table above.

Is anyone able to provide me with an example of how usage of the add_member commands may be used in nested tables?

1

There are 1 best solutions below

0
On BEST ANSWER

You call .Finish() on any tables you create with a table builder. You call .Finish(root) on your FlatBufferBuilder instance only once at the end to finish construction of the buffer.