• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Demonstrates the ability to have vectors of unions, and also to
2// store structs and strings in unions.
3
4table Attacker {
5  sword_attack_damage: int;
6}
7
8struct Rapunzel {
9  hair_length: int;
10}
11
12struct BookReader {
13  books_read: int;
14}
15
16union Character {
17  MuLan: Attacker,  // Can have name be different from type.
18  Rapunzel,         // Or just both the same, as before.
19  Belle: BookReader,
20  BookFan: BookReader,
21  Other: string,
22  Unused: string
23}
24
25table Movie {
26  main_character: Character;
27  characters: [Character];
28}
29
30root_type Movie;
31file_identifier "MOVI";
32