[Dev-luatex] return value of filter callbacks

Taco Hoekwater taco at elvenkind.com
Fri Nov 5 14:22:34 CET 2010


On 11/05/2010 01:59 PM, Manuel Pégourié-Gonnard wrote:
> Hi,
>
> Sorry if this is very clear from the manual, maybe I just didn't read the part
> where it is explained (or I read it but was too stupid/tired to notice), but I
> don't understand the meaning of the return value of some callbacks.
>
> The first example (by order of apparition in the manual) is
> pre_linebreak_filter, whose calling convention is:
>
> function(<node>  head,<string>  groupcode)
>      return true | false |<node>  newhead
> end
>
> I think it's clear what returning a newhead node does, but I don't understand
> what returning true or false means for this callback. Other similar callbacks
> include post_linebreak_filter, (h|v)pack_filter, pre_output_filter, etc.

In all these cases the result of returning a boolean is the same:

   false == callback has failed
   true == callback has run ok, but nothing has been changed

the latter case (true) is interesting because it allows a speed
optimization that can be considerable. I could have sworn this was
mentioned in the manual, but I cannot find it myself either.


More information about the dev-luatex mailing list