So I have a confusion about this problem:
It seems the only way to do this is by using a function or unpack:
First of all, when a function returns multiple values:
local function f()
return 1, 2, 3, 4, 5
end
local a, b, c, d, e = f()
They all have their respective numbers.> a=1, b=2…e=5
I can change that into a table:
local a = {f()}
They all have their respective indexes.> a[1]=1, a[2]=2…a[5]=5
BUT
When I try getting the type of this:
type(f())
It seems to get the type of the first value, which is 1
Now that says something. This also seems to be related with “nothing”
local function f() end
type(f()) --ERROR (also the same as type() without any arguments)
As opposed to nil (which ironically means nothing)
type(nil) -- "nil"
I feel like what is essentially happening here is that unpack({a, b, c}) acts more like flat out “a, b, c” that you can drag and drop into the code.
Still the question is: What is this mysterious value that acts like a table, that I feel like I can hold in my hand, but still can’t.