Hi Keith,
besides the useful I'd like to try to answer the questions:
> I find it hard to find in-depth documentation for luatex.
>
Well, the in-depth documentation is there, but it is meant for advanced
users/experts and it takes quite some time to dig through it. The reference
manual is excellent (IMO!) but you need to know quite some TeX to actively use
it.
> 1) As I understand it I can inject tex-code back to tex via texsprint,
> inside of
> a directly call.
Correct. Be aware that the tex.sprint("…") gets executed after you leave the
current \directlua{…} block.
(for a more technical discussion see http://tex.stackexchange.com/q/20893/243)
> 2) Is it possible to access and or manipulate tex-variable macros
> directly?
you can manipulate the standard TeX variables like tex.lefthyphenmin (see
4.13.1 of the reference manual). Other then that you cannot dig into the self
defined macros (I am not sure about this but have never come across the need to
do that, so someone else might clarify on that).
> 3) Is it possible to to save globals between directly calls?
yes, see:
++++++++++++++++++++++++++++++++++++++++++
\directlua{
myvar = "world"
}
Hello
\directlua{
tex.print(myvar)
}%
!
\bye
++++++++++++++++++++++++++++++++++++++++++
Patrick