Closed cmwelsh closed 12 years ago
I misread the Lua documentation. It said that unpack was equivalent to...
return list[i], list[i+1], ···, list[j]
Which I assumed meant something like this...
function test()
return list[i], list[i+1], ···, list[j]
-- is equivalent to
unpack(list)
end
But the actual behavior resembles this...
function test()
return list[i], list[i+1], ···, list[j]
-- is equivalent to
return unpack(list)
end
The reason "count" even exists is because it allows ReturnValue to delay being returned until it passes far enough down the stack, to recreate the first example's behavior. I'm removing it right now. Thank you for noticing this bug.
This patch fixes the Lua unpack function by modifying the value passed to the ReturnValues constructor function. It appears that your standard library requires the parameter "count" to be set to 1 or else it does not handle the thrown results exception...
Please weigh in if I'm missing something here. Thanks!