diff options
author | aardappel <aardappel@gmail.com> | 2019-05-22 19:42:13 -0700 |
---|---|---|
committer | aardappel <aardappel@gmail.com> | 2019-05-22 19:42:13 -0700 |
commit | 43dbac5d25c81918f917761d350a7a59db0fe84b (patch) | |
tree | 0aa91c32521abc69bb38e5c124c676f5200678e2 /tests/lobstertest.lobster | |
parent | 53ea1ab1bdedaaf98f581c5c7d96f1be2bd08db1 (diff) | |
download | flatbuffers-43dbac5d25c81918f917761d350a7a59db0fe84b.tar.gz flatbuffers-43dbac5d25c81918f917761d350a7a59db0fe84b.tar.bz2 flatbuffers-43dbac5d25c81918f917761d350a7a59db0fe84b.zip |
Lobster: added builder API for tables
Diffstat (limited to 'tests/lobstertest.lobster')
-rw-r--r-- | tests/lobstertest.lobster | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/tests/lobstertest.lobster b/tests/lobstertest.lobster index bfd8347b..7ea9b388 100644 --- a/tests/lobstertest.lobster +++ b/tests/lobstertest.lobster @@ -70,9 +70,10 @@ def make_monster_from_generated_code(): let inv = b.MyGame_Example_MonsterCreateInventoryVector([ 0, 1, 2, 3, 4 ]) - b.MyGame_Example_MonsterStart() - b.MyGame_Example_MonsterAddName(fred) - let mon2 = b.MyGame_Example_MonsterEnd() + let mon2 = MyGame_Example_MonsterBuilder { b } + .start() + .add_name(fred) + .end() b.MyGame_Example_MonsterStartTest4Vector(2) b.MyGame_Example_CreateTest(10, 20) @@ -88,19 +89,20 @@ def make_monster_from_generated_code(): let vector_of_doubles = b.MyGame_Example_MonsterCreateVectorOfDoublesVector( [ -1.7976931348623157e+308, 0, 1.7976931348623157e+308 ]) - b.MyGame_Example_MonsterStart() - b.MyGame_Example_MonsterAddPos(b.MyGame_Example_CreateVec3(1.0, 2.0, 3.0, 3.0, - MyGame_Example_Color_Green, 5, 6)) - b.MyGame_Example_MonsterAddHp(80) - b.MyGame_Example_MonsterAddName(name) - b.MyGame_Example_MonsterAddInventory(inv) - b.MyGame_Example_MonsterAddTestType(MyGame_Example_Any_Monster) - b.MyGame_Example_MonsterAddTest(mon2) - b.MyGame_Example_MonsterAddTest4(test4) - b.MyGame_Example_MonsterAddTestarrayofstring(test_array_of_string) - b.MyGame_Example_MonsterAddVectorOfLongs(vector_of_longs) - b.MyGame_Example_MonsterAddVectorOfDoubles(vector_of_doubles) - let mon = b.MyGame_Example_MonsterEnd() + let mon = MyGame_Example_MonsterBuilder { b } + .start() + .add_pos(b.MyGame_Example_CreateVec3(1.0, 2.0, 3.0, 3.0, + MyGame_Example_Color_Green, 5, 6)) + .add_hp(80) + .add_name(name) + .add_inventory(inv) + .add_test_type(MyGame_Example_Any_Monster) + .add_test(mon2) + .add_test4(test4) + .add_testarrayofstring(test_array_of_string) + .add_vector_of_longs(vector_of_longs) + .add_vector_of_doubles(vector_of_doubles) + .end() b.Finish(mon) |