From 50c22abae0772bddd61f0fca9be71dad8d3f4b09 Mon Sep 17 00:00:00 2001 From: Arseny Kapoulkine Date: Wed, 2 Jun 2021 13:19:46 -0700 Subject: [PATCH] Update syntax.md (#46) 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