\savepos=\savepos in lualatex. Why?

Your immediate problem

Unfortunately the gridset package defines a \savepos macro which has the same name as a LuaTeX primitive. If you don't need the LuaTeX \savepos functionality (at least under that exact name), you can do:

\let\luatexPrimitiveSavepos=\savepos
\let\savepos=\relax
\usapackage{gridpos}
\let\gridsetPackageSavepos=\savepos

similar to what you mentioned in the question, and then use either \luatexPrimitiveSavepos or \gridsetPackageSavepos, whichever you need, avoiding the ambiguous name \savepos.

Maybe the package could be changed to do something reasonable under LuaTeX automatically, or (if feasible) just use a different name instead of \savepos.


The “why”, as asked

In the LuaTeX engine, \savepos is a primitive. When TeX is asked to \show a primitive, it shows it as itself (for example, \show\def will show \def=\def).

This primitive is also present in the pdfTeX and XeTeX engines, under the name \pdfsavepos, but in the LuaTeX program they removed the pdf prefix. This is documented in the LuaTeX manual, section 2.1.4 Changes from pdfTeX 1.40:

Because position tracking is also available in dvi mode the \savepos, \lastxpos and \lastypos commands now replace their pdf prefixed originals.

Also (section 2.2 The backend primitives \pdf *):

If you also want some backward compatibility, you can add:
...
\let\pdfsavepos \savepos

(There are a bunch of such renamed primitives.)


What is \savepos (or \pdfsavepos)

Some notes on this primitive \savepos (in LuaTeX) or \pdfsavepos (in pdfTeX and XeTeX). It originates with pdfTeX, and is best documented in the pdfTeX manual:

\pdflastxpos (read–only integer)
This primitive returns an integer number representing the absolute x coordinate of the last point marked by \pdfsavepos. The unit is ‘scaled points’ (sp).
\pdflastypos (read–only integer)
Completely analogous to \pdflastxpos, returning the y coordinate.
...
▶ \pdfsavepos (h, v, m)
This primitive marks the current absolute (x, y) position on the media, with the reference point in the lower left corner. It is active only during page shipout, when the page is finally assembled. The position coordinates can then be retrieved by the \pdflastxpos and \pdflastypos primitives, and e.g. written out to some auxiliary file. The coordinates can be used only after the current \shipout has been finalized, therefore normally two pdfTeX runs are required to utilize these primitives. Starting with pdfTeX 1.40.0, this mechanism can be used also while running in DVI mode.

(As pointed out by @MarcelKrüger in a comment, the (h, v, m) indicates that this primitive can be used in any of the modes: horizontal mode / vertical mode / math mode.)

(As these primitives comes from pdfTeX, its extensions XeTeX and LuaTeX don't document them very extensively, the same way they don't document TeX primitives: in the XeTeX manual the explanation is brief, and entirely omitted in the LuaTeX manual.)

You can use them as follows:

% compile with pdflatex or xelatex
\documentclass{article}
\begin{document}
\pdfpageheight=2.5in % Really short pages, just so that I can get a screenshot.

yada yada\pdfsavepos eek\par
yada yada

\newpage

The last saved position was x=\the\pdflastxpos, and y=\the\pdflastypos.
\end{document}

or

% compile with lualatex
\documentclass{article}
\begin{document}
\pageheight=2.5in % Really short pages, just so that I can get a screenshot.

yada yada\savepos eek\par
yada yada

\newpage

The last saved position was x=\the\lastxpos, and y=\the\lastypos.
\end{document}

Both of which produce:

output

(Here, when compiling with lualatex and xelatex the “x” number is slightly different compared to compiling with pdflatex: the reason as @HenriMenke points out is that these two load Latin Modern by default, instead of pdflatex which loads cmr (Computer Modern) by default—and these fonts have slightly different metrics.)

See also the article pdfTeX’s little secret: Tracking positions by Hans Hagen in MAPS 25 (2000) pp. 74–78, which seems to be about these primitives.

This primitive (whether called \pdfsavepos or \savepos) is of course entirely unrelated to the \savepos macro defined by the gridset package. The package has unfortunately chosen a name that is used for a primitive by a newer engine.