Wireshark mailing list archives

Re: Does lua provide something like range strings?


From: Peter Wu <peter () lekensteyn nl>
Date: Tue, 9 Oct 2018 16:13:36 +0200

Hi Richard,

On Mon, Oct 08, 2018 at 10:59:35AM -0700, Richard Sharpe wrote:
I am wondering if the Lua interp in Wireshark provides the equivalent
of range strings?

Does anyone know?

I guess I could make the indexes strings, since they are associative
arrays anyway but looking up a value in a range would be difficult.

There does not seem to be support for range strings, but it could be
added. See value_string_from_table in epan/wslua/wslua_proto_field.c for
an example.

I suppose that the natural syntax would be:

    local your_range_string = {
        { 0, 24, "First quarter" },
        { 25, 54, "Second quarter" },
    };
-- 
Kind regards,
Peter Wu
https://lekensteyn.nl
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    https://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://www.wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request () wireshark org?subject=unsubscribe

Current thread: