aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorDavid Stephan <stephandavid3@gmail.com>2018-04-02 09:25:05 -0700
committerWouter van Oortmerssen <aardappel@gmail.com>2018-04-02 09:25:05 -0700
commit2e3d3cbcb5c89a7a2d923d08fff00dbf4c1f4a72 (patch)
treedb7b5abe5b9c9d3dc38be6d9fb69ad115f6b0fb3 /docs
parentd3a00f77308cf5bb11d8eadcce9895e3f3399c62 (diff)
downloadflatbuffers-2e3d3cbcb5c89a7a2d923d08fff00dbf4c1f4a72.tar.gz
Fix typos in C++ tutorial (#4685)
CreateMonster and MonsterBuilder examples fixed for C++
Diffstat (limited to 'docs')
-rw-r--r--docs/source/Tutorial.md14
1 files changed, 8 insertions, 6 deletions
diff --git a/docs/source/Tutorial.md b/docs/source/Tutorial.md
index cecfb5a9..1c54829f 100644
--- a/docs/source/Tutorial.md
+++ b/docs/source/Tutorial.md
@@ -949,15 +949,18 @@ can serialize the monster itself:
<div class="language-cpp">
~~~{.cpp}
+ // Create the position struct
+ auto position = Vec3(1.0f, 2.0f, 3.0f);
+
// Set his hit points to 300 and his mana to 150.
int hp = 300;
int mana = 150;
// Finally, create the monster using the `CreateMonster` helper function
// to set all fields.
- auto orc = CreateMonster(builder, Vec3(1.0f, 2.0f, 3.0f), mana, hp, name,
- inventory, Color_Red, weapons, Equipment_Weapon,
- axe.Union(), path);
+ auto orc = CreateMonster(builder, &position, mana, hp, name, inventory,
+ Color_Red, weapons, Equipment_Weapon, axe.Union(),
+ path);
~~~
</div>
<div class="language-java">
@@ -1120,15 +1123,14 @@ a bit more flexibility.
// You can use this code instead of `CreateMonster()`, to create our orc
// manually.
MonsterBuilder monster_builder(builder);
- monster_builder.add_pos(&pos);
- auto pos = Vec3(1.0f, 2.0f, 3.0f);
+ monster_builder.add_pos(&position);
monster_builder.add_hp(hp);
monster_builder.add_name(name);
monster_builder.add_inventory(inventory);
monster_builder.add_color(Color_Red);
monster_builder.add_weapons(weapons);
monster_builder.add_equipped_type(Equipment_Weapon);
- monster_builder.add_equpped(axe.Union());
+ monster_builder.add_equipped(axe.Union());
auto orc = monster_builder.Finish();
~~~
</div>