Tshark & lua


I have written a code in luascript which has to show only UDP packets from the captured wireshark packet,while running code in tshark it executes but in code I used the wlan.tap_packet function where I have to get the frame control,retry bit,sequncenumber,datarate it displays the all fields with in the function but after the end of function it doesn’t shows the values when giving print I have also used the “return” command but it dosen’t works and also I have to store these fields in an arrays how to store it? I have written part of my code .

wlan_tap = nil
– first we declare the tap called “http tap” with the filter it is going to use
wlan_tap = Listener.new(nil,“frame”)
local wlan_fc = Field.new(“wlan.fc”)
local wlan_retry = Field.new(“wlan.fc.retry”)
local wlan_seq = Field.new(“wlan.seq”)
local wlan_datarate = Field.new(“wlan.data_rate”)
local udp_port= Field.new(“udp.dstport”)

– this function is going to be called once each time the filter of the tap matches
function wlan_tap.packet (frame,wlan,udp,fc1,retry1,seq1,datarate1,dp1)
fc1 = tostring(wlan_fc())
retry1 = wlan_retry()
seq1 = wlan_seq()
datarate1 = wlan_datarate()
dp1 = dstport()
print(fc) --shows frame control field values
–print(retry) --retry bit
–print(seq) --sequence number
–print(dp) --Destination port in udp(5001)
print(fc) – not shows the frame control values