As luck would have it has 2 different meanings across 2 categories:
Adverb · Prep_phrase
by good fortune
"fortunately the weather was good"
by good fortune; fortunately or luckily.