The main macro in tkz-elements is \tkzGetNodes. This macro retrieves the elements from the z table in order to create nodes. The elements in the table provide the node name and its coordinates. The code for this macro is as follows:
\def\tkzGetNodes{\directlua{%
for K,V in pairs(z) do
local n,sd,ft
n = string.len(K)
if n > 1 then
_,_,ft, sd = string.find(K, "(.+)(.)" )
if sd == "p" then K=ft.."'" end
_,_,xft, xsd = string.find(ft, "(.+)(.)" )
if xsd == "p" then K=xft.."'".."'" end
end
tex.sprint("\\coordinate ("..K..") at ("..V.re..","..V.im..") ; \string\r")
end
}}
There is no problem with the contact details, but I am having difficulty processing the names.
Of course, whether it is on the lua or TeX side, certain characters are not accepted. As the use is primarily mathematical, I need certain characters. _ poses no difficulty, but in order to use prime (') and double prime (''), I had to find a workaround.
This involves reserving the letter p or the pair pp, replacing them with ' and '' if they appear at the end of a name.
Thus, z.Ap = point(1, 2) becomes node A' with coordinates (1, 2). z.Bpp becomes B'' and z.p becomes p.
Example:
\documentclass{standalone}
\usepackage[mini]{tkz-euclide}
\usepackage{tkz-elements}
\begin{document}
\directlua{
z.Ap = point(0, 0)
z.Bpp = point(5, 1)
z.p = point(2, 3)
% z.apo = point(1, 1)
}
\begin{tikzpicture}
\tkzGetNodes
\tkzDrawPolygon(A',B'',p)
\tkzDrawPoints(A',B'',p)
\tkzLabelPoints(A',B'')
\tkzLabelPoints[above](p)
\end{tikzpicture}
\end{document}
Question: How can I modify my macro so that point names that do not have a p at the end are accepted, but one or more letters p in their bodies? The following case appears to be the only one ...
With z.apo, I obtain
./name.tex:18: Package pgf Error: No shape named `apo' is known.
Ultimately, I am not filtering the names correctly, and with z.xpy, xpy is transformed into x''?


z.apollonius = point(1, 1)results in\coordinate (apollonius) at (1,1) ;. Is that not what you want? What do you want instead?foo.xis just syntactic sugar forfoo["x"]and if you use the latter form you are not limited to function names so you can use'and other characters.apothat there's a problem!\tkzGetNodesis called rather than once. if you split the lua out, you end up with a table of functions you can call and you don't have to think about tex syntax when writing them. instead you have something liketkz.GetNodesor maybe you define\tkzGetNodeson the lua side. see max's answers for ways to do that. none of this changes your package syntax.