Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Looking at LuaTEX Reference Manual (luatexref-t.pdf), it says:

4.13.1 Internal parameter values
For all the parameters in this section, it is possible to access them directly using their names as index in the tex table, or by using one of the functions tex.get() and tex.set().
...
4.13.1.1 Integer parameters
The integer parameters accept and return Lua numbers.
Read-write:
tex.adjdemerits tex.interlinepenalty
...

Ok, so I want to try tex.get - and I was grepping through my texlive installation looking for examples of its use, but no dice. So, I try a little test with whatever I can come up myself, but it segfaults on my machine (using Texlive 2011 updated to frozen version, Ubuntu 10.04); here is the MWE, compiled with lualatex test.tex:

\documentclass[12pt]{article}

\begin{document}

% this prints tex.get: nil / 1073741823
\directlua{print(""); print("tex.get: " .. tostring(tex.get(boxmaxdepth)) .. " / " .. tex.boxmaxdepth)}

% this segfaults:
% \directlua{print(""); print("tex.get: " .. tostring(tex.get("boxmaxdepth")) ) }

% this segfaults:
% \directlua{print(""); local tgp="boxmaxdepth"; print("tex.get: " .. tostring(tex.get(tgp)) )} % segfault

\end{document}

The strange thing is - tex.boxmaxdepth does indeed return something, and as per manual, so should tex.get("boxmaxdepth"); but any time I try to assign "boxmaxdepth" as a string, either directly or through a variable, I get a segfault - only way I don't get a segfault, is if I pass boxmaxdepth without quotation marks; which means its being interpreted by lua as a variable, which at that point is not set, and thus nil (_NB: first time I see a case where a null variable is the only way you don't get a segfault?! :) _)

Anyways - I hope it's something me not understanding the tex.get syntax, rather than this being a bug; so hopefully someone can clarify this for me :)

share|improve this question
1  
Confirmed with the latest luatex from svn. Please open a bug report at the LuaTeX bug tracker. –  Martin Schröder May 27 '12 at 15:15
1  
workaround: use tex.boxmaxdepth directly. –  Taco Hoekwater May 29 '12 at 9:15
    
@TacoHoekwater The segfault seems to occur from __index and get is just a wrapper. The code faults due to an comparison with "4" and an invalid pointer. In any case I come to this bug trying use get on "interactionmode". –  AbstractDissonance Jul 16 '12 at 10:45
add comment

1 Answer 1

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.