mirror of
https://github.com/luau-lang/luau.git
synced 2024-11-15 14:25:44 +08:00
Update syntax.md (#46)
Add documentation for named arguments in function types.
This commit is contained in:
parent
b20601af89
commit
50c22abae0
@ -142,6 +142,12 @@ function foo(x: number, y: number): (number, string)
|
||||
end
|
||||
```
|
||||
|
||||
Note that function types are specified without the argument names in the examples above, but it's also possible to specify the names (that are not semantically significant but can show up in documentation and autocomplete):
|
||||
|
||||
```lua
|
||||
local callback: (errorCode: number, errorText: string) -> ()
|
||||
```
|
||||
|
||||
Table types are specified using the table literal syntax, using `:` to separate keys from values:
|
||||
|
||||
```lua
|
||||
|
Loading…
Reference in New Issue
Block a user