Specify function return output

This commit is contained in:
boyned//Kampfkarren 2021-11-29 18:47:26 -08:00
parent d2cb1d784b
commit 8a2cb2ad62

View file

@ -89,6 +89,18 @@ When using safe navigation to call a function, the short circuiting will prevent
object?.doSomething(getValue())
```
This will return one `nil` if the object was nil.
```lua
function Class:returnTwoValues()
return 1, 2
end
-- Assuming `object` is `Class`, and `nilObject` is nil
print(object?:returnTwoValues()) -- 1, 2
print(nilObject?:returnTwoValues()) -- nil
```
The short-circuiting is limited within the expression.
```lua