mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-06 13:37:25 +00:00
It was outputting the type instead of the field name, and didn't deal with NULL fields. Added test case. Also fixed token enums having the wrong value, resulting in unreadable error messages. Change-Id: Icd9b4d22f417bfad5824c0f58e067ce3f2e2dc6f Tested: on Windows and Linux.
38 lines
790 B
Plaintext
Executable File
38 lines
790 B
Plaintext
Executable File
// example IDL file
|
|
|
|
namespace MyGame.Example;
|
|
|
|
enum Color:byte { Red = 0, Green, Blue = 2 }
|
|
|
|
union Any { Monster } // TODO: add more elements
|
|
|
|
struct Test { a:short; b:byte; }
|
|
|
|
struct Vec3 (force_align: 16) {
|
|
x:float;
|
|
y:float;
|
|
z:float;
|
|
test1:double;
|
|
test2:byte;
|
|
test3:Test;
|
|
}
|
|
|
|
table Monster {
|
|
pos:Vec3 (id: 0);
|
|
hp:short = 100 (id: 2);
|
|
mana:short = 150 (id: 1);
|
|
name:string (id: 3);
|
|
color:Color = Blue (id: 6);
|
|
inventory:[ubyte] (id: 5);
|
|
friendly:bool = false (deprecated, priority: 1, id: 4);
|
|
/// an example documentation comment: this will end up in the generated code
|
|
/// multiline too
|
|
testarrayoftables:[Monster] (id: 11);
|
|
testarrayofstring:[string] (id: 10);
|
|
enemy:Monster (id:12);
|
|
test:Any (id: 8);
|
|
test4:[Test] (id: 9);
|
|
}
|
|
|
|
root_type Monster;
|