So i am working on a function that will make it so i can have the same function for different variables. Here's what I tried:
function Multival (func, amt) local ValsToReturn for i = 1, amt, 1 do ValsToReturn = ValsToReturn, func end return ValsToReturn end
func is the function you need to call, amt is the amount of times you need to repeat it. the func returns something.
So im guessing you want to return multiple values from a function into more than one variable, at least thats what I hope.
Its actually super simple once you figure out that you can write variables on the same line like this:
local variable1, variable2 = 1, 2
So, if you want a function that returns more than one value to more than one variable, you can do this:
local function returnSomething() return 1, 2, 3, 4 end local var1, var 2, var3, var4 = returnSomething() print(var1) print(var3)
Expected Output: 1, 3
Hopefully that helps some.