From ed0269c900736f05c66d1ba3e094a0ec8aa6cbd2 Mon Sep 17 00:00:00 2001 From: Alexander McCord Date: Tue, 23 Mar 2021 12:02:03 -0700 Subject: [PATCH] Add missing docs for multiple returns. --- docs/_pages/syntax.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/_pages/syntax.md b/docs/_pages/syntax.md index ce5ab049..9080f71d 100644 --- a/docs/_pages/syntax.md +++ b/docs/_pages/syntax.md @@ -125,6 +125,17 @@ Function types are specified using the arguments and return types, separated wit local foo: (number, string) -> boolean ``` +To return no values or more than one, you need to wrap the return type position with parentheses, and then list your types there. + +```lua +local no_returns: (number, string) -> () +local returns_boolean_and_string: (nunber, string) -> (boolean, string) + +function foo(x: number, y: number): (number, string) + return x + y, tostring(x) .. tostring(y) +end +``` + Table types are specified using the table literal syntax, using `:` to separate keys from values: ```lua