Commit 0cf04ad9 authored by MikkelFJ's avatar MikkelFJ Committed by Wouter van Oortmerssen

Document type aliases (#4499)

parent fe483fa3
...@@ -84,15 +84,19 @@ parent object, and use no virtual table). ...@@ -84,15 +84,19 @@ parent object, and use no virtual table).
### Types ### 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: Built-in non-scalar types:
......
...@@ -216,6 +216,15 @@ The last part of the `schema` is the `root_type`. The root type declares what ...@@ -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 will be the root table for the serialized data. In our case, the root type is
our `Monster` table. 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 #### More Information About Schemas
You can find a complete guide to writing `schema` files in the You can find a complete guide to writing `schema` files in the
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment