Wireshark mailing list archives

Re: How to print longs from Lua?


From: philippe alarcon <philippe.alarcon () live fr>
Date: Tue, 30 Mar 2010 20:45:15 +0200


Hello Beth,


I have used this to display a L2 address of 4 bytes :


subtreeitem:add(tvbuffer(b_offset,4),  "L2 address   : " .. string.format('%08X',tvbuffer(b_offset,4):uint()) .. "h")
May be you can try to use this 2 times for every set of 4 bytes.


I hope this will help you.


Best Regards
Philippe

Date: Tue, 30 Mar 2010 13:35:47 -0400
From: beth.tridium () gmail com
To: wireshark-dev () wireshark org
Subject: [Wireshark-dev] How to print longs from Lua?

I'm writing a Lua post-dissector, where I wish to print MAC addresses (64-bit ints) to a Lua text window.  I can't seem 
to get it to work.

The best I can do so far is  "tostring(mac_addr)"  which prints the decimal equivalent of the lower 32 bits of the 
address.  What I would like is to print all 64 bits in hex.  I know that the "l" modifier normally used in printf/scanf 
etc (e.g. %lx) is not supported in Lua, so how do I print out this value?


If there is no way to print all 64 bits, then is there a way to split the value into upper and lower halves so that I 
can print each separately?

Thanks very much,
Beth



                                          
_________________________________________________________________
Consultez gratuitement vos emails Orange, Gmail, Free, ... directement dans HOTMAIL !
http://www.windowslive.fr/hotmail/agregation/
___________________________________________________________________________
Sent via:    Wireshark-dev mailing list <wireshark-dev () wireshark org>
Archives:    http://www.wireshark.org/lists/wireshark-dev
Unsubscribe: https://wireshark.org/mailman/options/wireshark-dev
             mailto:wireshark-dev-request () wireshark org?subject=unsubscribe

Current thread: