Suppose $Y$ is a subvariety of a variety $X$ (according to Hartshorne this means if $X$ is quasi-affine or quasi projective then $Y$ is a locally closed subset of $X$, c.f. exercise 3.10, chapter 1). Now given $i : Y \to X$ the inclusion map, I am trying to figure out what the stalk at $x \in Y$ of $i_\ast(\mathcal{O}_Y) $ is. Now if I unwind the definitions, firstly for any open set $U \subseteq X$ we have $i_\ast(\mathcal{O}_Y)(U) = \mathcal{O}_Y(U \cap Y)$. I guess that the stalk at $x$ of $i_\ast (\mathcal{O}_Y) $ should consist of pairs $\langle U \cap Y,f \rangle$ where $f$ is a regular function on $U \cap Y$.
However why should it be the case that on stalks the map induced from restriction $(\mathcal{O}_X)_x \to (i_\ast \mathcal{O}_Y)_x$ is surjective? This seems to be saying to me that any regular function on an open subset $U \cap Y$ of $Y$ is the restriction of some regular function on an open subset of $X$, but is this true?