frame.len not working as expected in Lua
I want to use the frame.len to further dissect the packet. I used the following logic and it failed:
frame_len_f = Field.new("frame.len")
local frame_len = frame_len_f()
if frame_len == 62 then
local data_data = data_data_f()
local s_data_data = tostring(data_data)
subtree:add(data_data_F,s_data_data)
end
However, if I convert frame.len to string and compare to "62", it works:
frame_len_f = Field.new("frame.len")
local frame_len = frame_len_f()
local s_frame_len = tostring(frame_len)
if s_frame_len == "62" then
local data_data = data_data_f()
local s_data_data = tostring(data_data)
subtree:add(data_data_F,s_data_data)
end
Can anyone explain what I did wrong in the first case. Thanks