Add missing docs for multiple returns. (#16)

This commit is contained in:
Alexander McCord 2021-03-23 12:58:16 -07:00 committed by GitHub
parent 98494e7ee8
commit 5f49e3fd95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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