I have stumbled on strange behaviour of lua. Code example:
function foo()
local t = {'a', 'b', 'c'}
return unpack(t)
end
function bar()
local t = {'x', 'y'}
return unpack(t)
end
b = { foo(), bar() }
for k,v in pairs(b) do
print(k,v)
end
Result of this code is:
1 a
2 x
3 y
So, results from foo() are all discarded except the first element. Question is, why some elements are discarded?
I have briefly checked lua 5.2 manual, but I don't see explanation for this behaviour.