# Where I can get information from about lua's functionalities in lualatex?

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
\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
\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
\directlua{test3()}
\end{longtable}

\end{document}

• It looks a bit odd to combine a question about longtable with a question about lua functions. Better split this. – Ulrike Fischer Jun 5 at 15:53
• as we have said on your previous questions the preloaded lua tables are documented in the luatex manual (mostly) – David Carlisle Jun 5 at 15:57
• texdoc luatex should open the manual – David Carlisle Jun 5 at 15:59
• you could also have found it on ctan, or the luatex project website. Not sure this question can really have an answer if the answer is simply "read the manual" . – David Carlisle Jun 5 at 16:08
• none of the tex engines provide any editing environment at all. IDEs may be developed but that is a completely separate thing. You can use whatever editor you like. In any case asking about IDE is a completely different question to the question posted here. – David Carlisle Jun 5 at 17:36

All the additional pre-loaded tables are documented in the luatex manual (texdoc luatex) as are most of the functions contained in those tables. Sometimes some experimental functions appear in the source before they are documented, so iterating over through the Lua can show some surprises, but in general you will find documentation for all entries.
• Why did I have to use $%s$ here([[%d & $%s$ & %s \\]], x, k, v)) in all those functions? k is a string type, but those functions don't work if use %s instead of $%s$! Which directory of TexLive should I use in VS Code to activate intellisense? – Emon Haque Jun 6 at 2:38