Can the convergence of sequence lead to the convergence of function as $x\to+\infty$

When read Zorich's book Mathematical Analysis Vol I, I figure out a question concerning the Theorem 5, Page 133. That is:

Assuming function $f:(0,+\infty)\to\mathbb{R}, \text{ with } \lim\limits_{\mathbb{N}\ni n\to\infty} f(n)=A\in\mathbb{R}\cup\{+\infty,-\infty\},$ where $\mathbb{N}$ is the set of all positive integers. Is it true that $\lim_{x\to+\infty} f(x)=A$?

I guess that it may be true. But I am not so sure. Maybe it is just a corollary of Theorem 5, page 133 of Zorich's Book (see above). Can anyone help me? If it is false, give your counterexample, and if it is true, prove it. Thanks a lot!

-

No. Consider $f(x) = \sin \pi x$.
The answer is negative, and the example by Hagen von Eitzen suffices. If you do not care about regularity, you can also consider the function $$f(x)= \begin{cases} 0 &\text{if x is rational} \\ 1 &\text{if x is irrational,} \end{cases}$$ for which $f(n)=0$ for all $n \in \mathbb{N}$ but $\lim_{x \to +\infty} f(x)$ does not exist for obvious reasons.
To understand the situation heuristically, you can recall that $\lim_{x \to +\infty} f(x)=\ell$ if and only if, for any sequence $x_n \to +\infty$ there results $f(x_n) \to \ell$ as $n \to +\infty$. It is reasonable that the behavior of $f$ along one sequence like $x_n=n$ cannot describe the richness of the behavior along any diverging sequence. You can approach $+\infty$ in infinitely many ways, and you must consider them all together, if you want to compute the limit.