So, right now it's a joint question. I wanted to know if you can use the comma's to make the local equal to a certain thing. For example:
local HeadshotDmg, LimbDmg, TorsoDmg = multipleArray(Settings.Damage, 3)
If so, my next question would be how would I end up doing this? This is what I got so far:
function multipleArray(array, amount) local values = {} for i, v in pairs(array) do print(array[i]) -- Probably somewhere for the return over here end end
What you're looking for is called a tuple
you can make a function return a tuple by just returning multiple values, separated by commas, and or semicolons.
function multipleArray(array) return array[1],array[2],array[3] --You can also use the 'unpack' function end local tab = {3,2,1} local a,b,c = multipleArray(tab) --a is now 3 --b is now 2 --c is now 1
I'm not sure how you want to use this to your advantage but here!