Change TreeItem value Lua
asked Aug 26 '25
We are researching how to add composite values to the protocol tree. It would be ideal to parse the child fields first and update the parent "composite". One thing that is missing is a set_value(). Is there a method to update the "show" value in the protocol tree.
Here is an example of an output in PDML:
<field name="cme.futures.ilink3.sbe.v8.5.timetoexpiration" showname="Time To Expiration: " size="5" pos="247" show="" value="ffffff7f7f">
<field name="cme.futures.ilink3.sbe.v8.5.mantissa32" showname="Mantissa 32: No Value" size="4" pos="247" show="2147483647" value="ffffff7f"/>
<field name="cme.futures.ilink3.sbe.v8.5.exponent" showname="Exponent: No Value" size="1" pos="251" show="127" value="7f"/>
</field>
Is there a way to update the show="" attribute of the parent? We could generate 2 separate reader functions as an alternate.
Thanks in advance

(Related to Update parent tree node)
WSDG: 12.7.1. TreeItem
Would
12.7.1.4. treeitem:set_text(text)or12.7.1.15. treeitem.textwork?When I tried:
I got:
Sorry. Work to be done in the documentation and terms used.
treeitem:set_text(text)- "Sets the text of the label."treeitem.text- "Set/get the TreeItem's display string (string)."These update the "Description" string as mentioned below.
WSUG: Table 6.3. The menu items of the “Packet Details” pop-up menu
Copy → Description- "Copy the displayed text of the selected field to the system clipboard."Copy → Fieldname- "Copy the name of the selected field to the system clipboard."Copy → Value- "Copy the value of the selected field to the system clipboard."You would like to update the value of the field in the tree?
Yes, the value of the group/struct copies as (null). I would like to change that value post dissection of the child fields. There does not seem to be a set_value()
Possible solution?
Ask: How to change a proto_item value at dissector?
The composite type should resolve to an 8 byte unsigned integer. Here is the generated code:
Here is the output xml:
How can I set the tree item to the returned "value" without having to read the fields multiple times? (We can generate this, but it would be less elegant)
You could send this to the
Wireshark-devemail list.Not everyone follows the Ask questions so you might get a better solution or maybe an explanation of why there is no "set_value" function.