[luatex] The node returned by node.traverse().

luigi scarso luigi.scarso at gmail.com
Thu Feb 16 11:09:32 CET 2012


On Thu, Feb 16, 2012 at 7:24 AM, Paul Isambert <zappathustra at free.fr> wrote:
> The C parlance eludes me, as you know, but reworded in Lua: "head" and
> "head1" do not even point to the same userdata:
>
> %%%%
> \setbox0=\hbox{a}
>
> \directlua{%
>  local head = tex.box[0].head
>  local head1 = tex.box[0].head
>  getmetatable(head).__tostring = nil
>  print(head, head1)
> }
>
> \bye
> %%%%
Hm, print(head,head1) is print(tostring(head),tostring(head1))
and tostring(head) gives the address of an internal "objects" used to
access the "raw userdata"
--- but has almost no practical use.
I mean that if the addresses differ than we cannot say that the "raw
userdata" are different .
I think to head and head1 as different "proxy objects" to access the
same raw userdata:
if rawequal(head,head1) is true than they are the same proxy object
and hence they manage the same raw userdata;
if rawequal(head,head1) is false than they are different proxy
objects, but they can manage the same raw userdata;
and if head == head1 is true than the raw userdata they manage is
viewed as equal.

At least, this is how I see these things.


-- 
luigi



More information about the luatex mailing list