lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi,

I am writing LUA disectors for Wireshark packets. I am calling a utility application written in C from LUA file. I am getting a string (null terminated) from C application which in in hex string format (like 2CA000).

I want to  convert this string in numeric or float format with LUA' API like uint or float but LUA fails in conversion. I used to do operations as below

function directmip_proto.dissector(buffer,pinfo,tree)
.
.
print("Port  ", buffer(2, 2):uint())

In the same way, I am trying to do same operations with output (hex string) given by C utilty  but it is failing for this string (2CA000).

I have checked the type of buffer as

print("Port  ", type(buffer(2, 2)))   //output  is userdata

but for my output (2CA000), type is string.

So I want an API which converts the datatype into userdata or any API which converts the hex string into numeric format.

Thanks in Advance
Awadhesh