forked from BigfootDev/flatbuffers
Document type aliases (#4499)
This commit is contained in:
committed by
Wouter van Oortmerssen
parent
fe483fa380
commit
0cf04ad9d5
@@ -84,15 +84,19 @@ parent object, and use no virtual table).
|
||||
|
||||
### Types
|
||||
|
||||
Built-in scalar types are:
|
||||
Built-in scalar types are
|
||||
|
||||
- 8 bit: `byte`, `ubyte`, `bool`
|
||||
- 8 bit: `byte` (`int8`), `ubyte` (`uint8`), `bool`
|
||||
|
||||
- 16 bit: `short`, `ushort`
|
||||
- 16 bit: `short` (`int16`), `ushort` (`uint16`)
|
||||
|
||||
- 32 bit: `int`, `uint`, `float`
|
||||
- 32 bit: `int` (`int32`), `uint` (`uint32`), `float` (`float32`)
|
||||
|
||||
- 64 bit: `long`, `ulong`, `double`
|
||||
- 64 bit: `long` (`int64`), `ulong` (`uint64`), `double` (`float64`)
|
||||
|
||||
The type names in parentheses are alias names such that for example
|
||||
`uint8` can be used in place of `ubyte`, and `int32` can be used in
|
||||
place of `int` without affecting code generation.
|
||||
|
||||
Built-in non-scalar types:
|
||||
|
||||
|
||||
@@ -216,6 +216,15 @@ The last part of the `schema` is the `root_type`. The root type declares what
|
||||
will be the root table for the serialized data. In our case, the root type is
|
||||
our `Monster` table.
|
||||
|
||||
The scalar types can also use alias type names such as `int16` instead
|
||||
of `short` and `float32` instead of `float`. Thus we could also write
|
||||
the `Weapon` table as:
|
||||
|
||||
table Weapon {
|
||||
name:string;
|
||||
damage:int16;
|
||||
}
|
||||
|
||||
#### More Information About Schemas
|
||||
|
||||
You can find a complete guide to writing `schema` files in the
|
||||
|
||||
Reference in New Issue
Block a user