function f() end
tostring(f()) --what happens here?
This code causes an error, which I think is not obvious, with the message "bad argument #1 to 'tostring' (value expected)" I believe this is because the number of values returned by f is 0 which means the vararg passed into tostring has length 0.
This is quite odd in terms of how the code looks, now consider the following function:
function transform(f)
return function(x, ...) return f(x, ...) end
end
This looks rather redundant, but transform(tostring)(f()) will not produce an error, which is perhaps even weirder.
Is this supposed to behave like this?