summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authoraardappel <aardappel@gmail.com>2019-05-22 19:42:13 -0700
committeraardappel <aardappel@gmail.com>2019-05-22 19:42:13 -0700
commit43dbac5d25c81918f917761d350a7a59db0fe84b (patch)
tree0aa91c32521abc69bb38e5c124c676f5200678e2 /docs
parent53ea1ab1bdedaaf98f581c5c7d96f1be2bd08db1 (diff)
downloadflatbuffers-43dbac5d25c81918f917761d350a7a59db0fe84b.tar.gz
flatbuffers-43dbac5d25c81918f917761d350a7a59db0fe84b.tar.bz2
flatbuffers-43dbac5d25c81918f917761d350a7a59db0fe84b.zip
Lobster: added builder API for tables
Diffstat (limited to 'docs')
-rw-r--r--docs/source/Tutorial.md36
1 files changed, 19 insertions, 17 deletions
diff --git a/docs/source/Tutorial.md b/docs/source/Tutorial.md
index 14961b77..dc09c181 100644
--- a/docs/source/Tutorial.md
+++ b/docs/source/Tutorial.md
@@ -815,10 +815,11 @@ our `orc` Monster, lets create some `Weapon`s: a `Sword` and an `Axe`.
let weapon_offsets = map(weapon_names) name, i:
let ns = builder.CreateString(name)
- builder.MyGame_Sample_WeaponStart()
- builder.MyGame_Sample_WeaponAddName(ns)
- builder.MyGame_Sample_WeaponAddDamage(weapon_damages[i])
- builder.MyGame_Sample_WeaponEnd()
+ MyGame_Sample_WeaponBuilder { b }
+ .start()
+ .add_name(ns)
+ .add_damage(weapon_damages[i])
+ .end()
~~~
</div>
<div class="language-rust">
@@ -1503,17 +1504,18 @@ can serialize the monster itself:
</div>
<div class="language-lobster">
~~~{.lobster}
- builder.MyGame_Sample_MonsterStart()
- builder.MyGame_Sample_MonsterAddPos(builder.MyGame_Sample_CreateVec3(1.0, 2.0, 3.0))
- builder.MyGame_Sample_MonsterAddHp(300)
- builder.MyGame_Sample_MonsterAddName(name)
- builder.MyGame_Sample_MonsterAddInventory(inv)
- builder.MyGame_Sample_MonsterAddColor(MyGame_Sample_Color_Red)
- builder.MyGame_Sample_MonsterAddWeapons(weapons)
- builder.MyGame_Sample_MonsterAddEquippedType(MyGame_Sample_Equipment_Weapon)
- builder.MyGame_Sample_MonsterAddEquipped(weapon_offsets[1])
- builder.MyGame_Sample_MonsterAddPath(path)
- let orc = builder.MyGame_Sample_MonsterEnd()
+ let orc = MyGame_Sample_MonsterBuilder { b }
+ .start()
+ .add_pos(b.MyGame_Sample_CreateVec3(1.0, 2.0, 3.0))
+ .add_hp(300)
+ .add_name(name)
+ .add_inventory(inv)
+ .add_color(MyGame_Sample_Color_Red)
+ .add_weapons(weapons)
+ .add_equipped_type(MyGame_Sample_Equipment_Weapon)
+ .add_equipped(weapon_offsets[1])
+ .add_path(path)
+ .end()
~~~
</div>
<div class="language-rust">
@@ -1687,8 +1689,8 @@ Here is a repetition these lines, to help highlight them more clearly:
</div>
<div class="language-lobster">
~~~{.lobster}
- builder.MyGame_Sample_MonsterAddEquippedType(MyGame_Sample_Equipment_Weapon)
- builder.MyGame_Sample_MonsterAddEquipped(axe)
+ .add_equipped_type(MyGame_Sample_Equipment_Weapon)
+ .add_equipped(axe)
~~~
</div>
<div class="language-rust">