mirror of
https://github.com/luau-lang/luau.git
synced 2025-05-04 10:33:46 +01:00
Update trackable-types.md
This commit is contained in:
parent
446fa87f74
commit
470c9170ff
1 changed files with 3 additions and 1 deletions
|
@ -30,9 +30,11 @@ type Font = "Font1" | "Font2" | "Font3"
|
|||
type Object = {X: number, Y: number, text: string | <nil_status = nil>, font: Font | nil_status}
|
||||
```
|
||||
|
||||
Between the angle brackets, a name followed by an equals sign and then a type is expected. Alternatively, a name followed by nothing can be used to track something with a name already associated with a type.
|
||||
|
||||
The scope of these types should be the function in which they are used in. If they aren't defined in a function, then it is the global scope.
|
||||
|
||||
In this code, the type of `font` will never change the type of `text`, but the opposite is true. If `font` is guaranteed to be non-nil, text isn't. To make it replicate to text as well, `font` should have the type `<nil_status>` without initialization.
|
||||
The type of `font` will never change the type of `text`, but the opposite is true. If `font` is guaranteed to be non-nil, text isn't. To make it replicate to text as well, `font` should have the type `<nil_status>` without initialization.
|
||||
|
||||
```lua
|
||||
type Font = "Font1" | "Font2" | "Font3"
|
||||
|
|
Loading…
Add table
Reference in a new issue