Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to get a function to return more than one value?

Asked by 5 years ago

So I'm making a script that requires the function to return two separate values. How would I be able to store those two values? I know I can store one value if I define a variable for the function, but I don't know how to do it for more than one value. Thanks Kevin.

0
return a,b greatneil80 2647 — 5y
0
How would i store the values in variables? kevinliwu1 9 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago

``` local function twoReturnValues() return "Hello", "world!" end

local return1, return2 = twoReturnValues()

print(return1) --> Hello print(return2) --> world! ```

0
Thanks kevinliwu1 9 — 5y
Ad

Answer this question