I've read several answers here on Stackexchange about this, but the actual requirements on $f$ and $g$ are different in different answers, and sometimes in quite substantial ways. Furthermore, I think there are some subtleties here relating to the domains of $f$ and $g$, especially when talking about $g^{-1}$.
I'll begin by giving a motivating example. Suppose we wish to find: $$ \lim_{t\to 0}\frac{\sin(\tan t)}{\tan t}. $$
What we do is make the substitution $x = \tan t$ and then use that $$ \lim_{x\to 0}\frac{\sin(x)}{x} = 1. $$
So what we have is an inner function $g(t) = \tan t$ and an outer function $f(x) = \frac{\sin x}{x}$. We're making the claim that if $\lim_{t\to a} g(t) = L$, then $$ \lim_{t \to a} f(g(t)) = \lim_{g(t) \to L} f(g(t)) $$
My question is about the assumptions on $f$ and $g$ for this to hold. I know that the limit of $g$ at $a$ has to exist. But what about other requirements? I've seen continuity for $f$ be demanded, but also versions where $f$ has no requirements whatsoever, but $g$ has to be injective and continuous. Other claims have been that $g$ simply has to be invertible. In particular, for this example $f$ is not continuous at the point of interest.