Normally _G table
/ _ENV table
query returns 38 entries in console BUT when we are on lualatex
it returns (121 minus normal 38 minus my 3 functions below) = 80 additional entries. Some are self-explanatory, e.g. socket, unicode, version, etc. BUT others are not.
One of those 80 additional types
is tex
and I've used two out of a total of hundred functions, namely print
and sprint
, from it and I don't know the
usage of the rest! Besides, tex
has 17 more tables in it.
On my installation folder I've a readme.en.html
, it's over 3k links of pdf
documents and I think those are package
oriented and it's practically impossible for anyone to go through all of those. AFAIK, LuaTeX doesn't have an IDE like Visual Studio, Qt, IntelliJ IDEA that lists all types
along with relevant information to help us get better with it! Does it have detailed documentation on those 80 additional entries it loads with lualatex and functionalities of those functions/types for its end user?
To get those information, I've these 3 functions in a .lua
file:
local x
-- lists contents of _G Table
function test1()
x = 0
for k, v in pairs(_G) do
x = x + 1
tex.print(string.format([[%d & $%s$ & %s \\]], x, k, v))
end
end
-- lists functions of tex table
function test2()
x = 0
for k, v in next, tex do
if type(v) == 'function' then
x = x + 1
tex.print(string.format([[%d & $%s$ & %s \\]], x, k, v))
end
end
end
--lists types other than function of tex table
function test3()
x = 0
for k, v in pairs(tex) do
if type(v) ~= "function" then
x = x + 1
tex.print(string.format([[%d & $%s$ & %s & %s \\]], x, k, v, type(v)))
end
end
end
and on my tex
file, I've these:
\documentclass{report}
\usepackage[a4paper, margin = 1in]{geometry}
\usepackage{longtable}
\directlua{require("test")}
\begin{document}
\centering \_G-Table
\begin{longtable}{p{.1\textwidth} | p{.4\textwidth} | p{.5\textwidth}}
\hline Sl. & Function / Table / etc. & Address \& Info \\ \hline
\endhead \hline \endfoot \hline \endlastfoot
\directlua{test1()}
\end{longtable}
\centering Functions in $tex$ Table
\begin{longtable}{p{.1\textwidth} | p{.4\textwidth} | p{.5\textwidth}}
\hline Sl. & Function Name & Address \\ \hline
\endhead \hline \endfoot \hline \endlastfoot
\directlua{test2()}
\end{longtable}
\centering Non-Function types in $tex$ Table
\begin{longtable}{p{.1\textwidth} | p{.2\textwidth} | p{.4\textwidth} | p{.3\textwidth}}
\hline Sl. & Name & Address & Type \\ \hline
\endhead \hline \endfoot \hline \endlastfoot
\directlua{test3()}
\end{longtable}
\end{document}
texdoc luatex
should open the manual