lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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")