mirror of
https://github.com/luau-lang/luau.git
synced 2025-05-04 10:33:46 +01:00
Added syntax highlighting
This commit is contained in:
parent
6c18e25241
commit
436ebff11c
1 changed files with 4 additions and 4 deletions
|
@ -75,7 +75,7 @@ For a module's exports, we can make use of Luau's notion of *subtyping*. The bas
|
|||
|
||||
For example, if a module exports:
|
||||
|
||||
```
|
||||
```lua
|
||||
function pet() : Animal -- old version
|
||||
function pet() : Cat -- new version
|
||||
```
|
||||
|
@ -83,7 +83,7 @@ For example, if a module exports:
|
|||
then this is a minor change, since `() -> Cat` is a subtype of `() -> Animal`, but
|
||||
if it also exports:
|
||||
|
||||
```
|
||||
```lua
|
||||
function adopt(a : Animal) -- old version
|
||||
function adopt(c : Cat) -- new version
|
||||
```
|
||||
|
@ -142,14 +142,14 @@ As well as exported values, modules can export type aliases. For example:
|
|||
These types are type aliases, and are treated *structurally* not
|
||||
*nominally*, for example a user can write:
|
||||
|
||||
```
|
||||
```lua
|
||||
local p : Point = { x=5, y=8 }
|
||||
local a : number = p.x + p.y
|
||||
```
|
||||
|
||||
and since table types support [width subtyping](sealed-table-subtyping.md), users can add properties:
|
||||
|
||||
```
|
||||
```lua
|
||||
local q : Point = { x=5, y=8, z="hi" }
|
||||
```
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue