[luatex] First (optional?) arguments of tex.getcount and friends.
st_philipp at yahoo.de
Tue May 10 17:36:04 CEST 2011
Am 10.05.2011 um 15:44 schrieb Taco Hoekwater:
> 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.:
>> 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.
Yes, but that is the first argument, not the last. Lua functions ignore any additional arguments that are appended to the argument list, but not those that are prepended. Maybe some sign error? 1 instead of -1?
$ lua - <<< 'function test(foo) print(foo) end test(1, 2, 3)'
More information about the luatex