I have a question from Algebraic Geometry by Robin Hartshorne. Here is a proof in the textbook:

Theorem. Let X be a variety and Y \subseteq \mathbb{A}^n be an affine variety. Let x_1, \ldots, x_n be the coordinate functions on \mathbb{A}^n. A map of sets \psi : X \rightarrow Y is a morphism if and only if x_i \circ \psi is a regular function on X for each i=1, \ldots, n.

Proof
(\Rightarrow) If \psi is a morphism then the x_i \circ \psi are regular functions. This is by the definition of a morphism.

(\Leftarrow) Suppose the x_i \circ \psi are regular. Let f=f(x_1, \ldots, x_n) be any polynomial. Then f \circ \psi is also regular on X. Now because the closed sets of Y are defined by the vanishing of polynomial functions and because regular functions are continuous, \psi^{-1} takes closed sets to closed sets. So \psi is continuous. Recall that regular functions on open subsets of Y are locally quotients of polynomials. Hence g \circ \psi is regular where g is a regular function on any open subset of Y. Therefore \psi is a morphism.

There is no definition for the i-th coordinate function given in this textbook. I looked in Ideals, Varieties, and Algorithms and it gives the following definition:

Definition
(i) Given a polynomial f \in k[x_1, \ldots, x_n], we let \overline{f} denote the polynomial function in A(X) represented by f.

(ii) Each variable x_i gives a polynomial function \overline{x_i} : X \rightarrow k whose value at a point p \in X is the i-th coordinate of p. We call \overline{x_i} \in A(X) the i-th coordinate function on X.

Is this the same definition that Hartshorne is using? If it is different, what is the correct definition? Thanks.