Wireshark-bugs: [Wireshark-bugs] [Bug 10695] Lua Proto:register_heuristic should accept Dissecto

Date: Mon, 15 Dec 2014 19:17:58 +0000

Comment # 3 on bug 10695 from
(In reply to Matthijs Kooijman from comment #1)
> There is one additional side to this: it seems that Dissector_call does not
> actually forward the dissector's return value. This means that a workaround
> like:
> 
>         foo:register_heuristic("wpan", function(...) foo.dissector(...) end)
> 
> Doesn't actually work - it always lets the heuristic function return nil,
> declining the packet.

Because your lambda function doesn't return anything.  If your foo.dissector()
returns true/false, then your lambda should be:

    function(...) return foo.dissector(...) end

Or, you could instead simply separately create a Lua function that that does
what you want, and then set both the Proto's dissector and register the
heuristic to that Lua function.  For example:

    local myFunction(tvb, pinto, tree)
        ... -- do stuff
    end

    foo.dissector = myFunction
    foo:register_heuristic("wpan", myFunction)


You are receiving this mail because:
  • You are watching all bug changes.