[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Odd behaviour with multiple return values and varargs
- From: "John Calsbeek" <nexuapex@...>
- Date: Wed, 12 Sep 2007 16:44:04 -0500
Problems with multiple return values not getting truncated:
function maybeval()
if not errorCondition then
return someValue -- bad things happen if this is return someValue, nil
else
return nil, "error message"
end
end
-- If the return was someValue, nil there are problems
-- but if the return is specified as above it works fine
-- up until an error. Hopefully the programmer wasn't
-- expecting it to just pass nil to somefunc, 'cause it won't.
somefunc(maybeval(), "some other value")