Does the code below help?
fall = function () end
ret = function () return end
retnil = function () return nil end
this = function (...) return ... end
print() --> (nothing)
print(nil) --> nil
print(nil, nil) --> nil nil
print(fall()) --> (nothing)
print(ret()) --> (nothing)
print(retnil()) --> nil
print(this()) --> (nothing)
print(this(nil)) --> nil
print(this(nil, nil)) --> nil nil
print(select("#")) --> 0
print(select("#", nil)) --> 1
print(select("#", nil, nil)) --> 2
print(select("#", fall())) --> 0
print(select("#", ret())) --> 0
print(select("#", retnil())) --> 1
print(select("#", this())) --> 0
print(select("#", this(nil))) --> 1
print(select("#", this(nil, nil))) --> 2
The language would be more complex and less elegant if "return" and
"return nil" were the same - it wouldn't be so easy to return an empty
list of results...
On Sun, Sep 11, 2011 at 04:47:34PM +0200, Lorenzo Donati wrote:
But it is not clear that "return" with an empty explist is the same as
returning with no return statement (currently it behaves that way, but
can we rely on that?)
Racking my brains and letting my imagination roam, I have come up with
a complete inventory of what besides an empty explist might be returned
if no return statement is encountered. It is given below between the
two comment lines.
-- start inventory
-- stop inventory