I'm trying to use values from expanded macros within a direct lua block, but I can't figure out how to get a value from any macro that has braces in it.
\directlua { tex.print(\value{footnote}} }
Never works the way i expect it, All i want it to do is for it to print out the current value of the counter footnote. Do I need to escape the braces?
A minimal example that doesnt work:
\documentclass[12pt, a4paper]{article}
\usepackage{geometry}
\geometry{a4paper}
\usepackage{graphicx}
\usepackage{epstopdf}
\begin{document}
\footnote{hello}
\directlua { tex.enableprimitives('',tex.extraprimitives()) }
\catcode `\{=1
\catcode `\}=2
\directlua { here = here or {}; here.foo = 5 }
\directlua { here = here or {}; tex.print(here.foo + 5) }
\directlua { tex.print(\value{footnote}} }
\end{document}
And the errors;
*geometry* driver: auto-detecting
*geometry* detected driver: pdftex
(/usr/local/texlive/2010/texmf-dist/tex/context/base/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
)
! LuaTeX error <\directlua >:1: unexpected symbol near '\'.
l.13 \directlua { tex.print(\value{footnote}}
}
?
\