From 0241d8264fc8eda011f9c90220693f217698123b Mon Sep 17 00:00:00 2001 From: Arseny Kapoulkine Date: Wed, 2 Jun 2021 13:18:13 -0700 Subject: [PATCH] Update syntax.md Add documentation for named arguments in function types. --- docs/_pages/syntax.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/_pages/syntax.md b/docs/_pages/syntax.md index aacd5322..204bc68c 100644 --- a/docs/_pages/syntax.md +++ b/docs/_pages/syntax.md @@ -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