ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
July 17th, 2024 | 10:00am-11:55am SGT (UTC+8) | Online

Wireshark-dev: [Wireshark-dev] How to print longs from Lua?

Date: Tue, 30 Mar 2010 13:35:47 -0400
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