[luatex] First (optional?) arguments of tex.getcount and friends.

Paul Isambert zappathustra at free.fr
Tue May 10 16:04:09 CEST 2011


Le 10/05/2011 15:44, Taco Hoekwater a écrit :
> On 05/10/2011 03:42 PM, Paul Isambert wrote:
>> Hello all,
>>
>> I have noticed that the function tex.getcount() and similar can take any
>> number of arguments and ignore them all but the last. E.g.:
>>
>> \directlua{
>> texio.write_nl(tex.getcount("a string", nothing, node.new(11), 55, 0))
>> }
>>
>> returns "1", i.e. the value of count 0, ignoring the string, the nil
>> value, the node, and the number.
>>
>> Is that normal? Am I missing something? My LuaTeX is 0.71.
>
> I am not surprised: lua pushes the arguments on a stack, and then the
> getcount function takes the topmost entry. I could add an explicit
> test for the number of arguments, but that is a bit of wasted effort,
> in Hans' and my opinion.

Well, that could be useful in the quite unlikely situation where you 
pass several arguments to a function whose definition and number of 
arguments might change and you expect it to discard the last ones if 
necessary. Admittedly not worth the test.

Thanks for the explanation,
Paul


More information about the luatex mailing list