how to convert string protofield to number in wireshark lua dissector

773 Views Asked by At

I'm now developing a wireshark dissector with lua. There has one filed means length in packet which is encoded by ASCII, and it's displayed as string in dissection tree and display filter, like this

MyProto.length == "0237"

In fact, I want it to be number, so i can use "great than" or "less than" in display filter.

So, how to do it in lua dissector?

1

There are 1 best solutions below

2
warspyking On

Are you asking how to turn a string into a number? If so it's very easy!

print(type(tonumber("0237")))