79278985

Date: 2024-12-13 16:40:07
Score: 0.5
Natty:
Report link

Assuming a protocol listener pattern, you can simply add to obtain a subtree and then add in a loop the values, for example:

function DecoderListener:setParameter(widgetID, paramID, value)
    if (type(value) == "table") then
        local array_tree = self.subtree:add(paramID)
        if #value >= 1 then
            for i, value0 in ipairs(value) do
                self:setArrayParameter(array_tree, value0, i)
            end
        end
    end
end

function DecoderListener:setArrayParameter(array_tree, value, index)
    local real_value = value:getValue()
    -- this can handle int/float/string real values
    array_tree:add(real_value)
end

This will result in folding elements in Wireshark with all the values you have speficied.

Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Arnault Bonafos