Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: [Wireshark-dev] Lua dissector adds trees but they have (null) in front of the tr

From: Richard Sharpe <realrichardsharpe@xxxxxxxxx>
Date: Sat, 20 Oct 2018 12:25:47 -0700
Hi folks,

I have a small generated capture that has a three-byte header, with
the first being a function code and the next two being the length.

I handle them like this in Lua:

    local t_header = tree:add(buffer, label)
    t_header:add(f_function, buffer(offset, 1))
    offset = offset + 1
    t_header:add(f_length, buffer(offset, 2))
    offset = offset + 2

However, each subtree (there is another as well), appears with
'(null)' in front of it.

At first I thought maybe it was because I did not specify the length
of the buffer, so I added this at the end:

    t_header:set_len(offset - saved_offset)

However, that has not fixed the problem.

Does anyone know what I need to do to fix this?

-- 
Regards,
Richard Sharpe
(何以解憂?唯有杜康。--曹操)(传说杜康是酒的发明者)