The metallicity dependence of the long-duration gamma-ray burst rate from host galaxy luminosities