Given the definition
$$e = \lim_{h\rightarrow 0} (1+h)^{1/h}$$
I noticed that the limit
$$\lim_{h\rightarrow 0} (1+hx)^{1/h}$$
could be evaluated via substituting $u = hx$ in the following way.
$$\lim_{h\rightarrow 0} (1+hx)^{1/h} = \lim_{u\rightarrow 0} (1+u)^{x/u}=\left( \lim_{u\rightarrow 0} (1+u)^{1/u}\right)^{x} = e^{x}$$
I'm having a little trouble finding a reference stating under what conditions a substitution of this nature is valid. It seems to work out correctly here, but I don't know with confidence whether or not similar substitutions would work for other problems with guaranteed accuracy.
Therefore, I am wondering: under what circumstances does the following substitution generalization hold?
$$\lim_{x\rightarrow a} f(g(x)) = \lim_{u\rightarrow \underset{x \rightarrow a}{\lim} g(x)} f(u).$$
This holds if $f$ and $g$ are continuous at $g(a)$ and $a$ respectively. Continuity of $g$ implies $\lim_{x\to a}g(x) = g(a)$, and then continuity of $f$ and $f\circ g$ ensures $$\lim_{u\to g(a)}f(u) = f(g(a)) = \lim_{x\to a}f(g(x))$$