This should be fine. So, just to confirm, a loop like this would work:
t = {10, 20, 30}
for element in values(t) do
print(element)
end
But values() would NOT be implemented like this:
function values(t)
next, t, nil
end
But rather it could be implemented with closures:
function values(t)
local pos = 0
return function()
i = i + 1
return t[i]
end
end
Correct? If yes, I agree. In the worst case we would be able to add the three-variables concept later and still keep compatibility with any previous code, right?