-- Create a fields table and add the field to it
xran_protocol.fields = {RuPortId_F}
-- Then specify the dissector function
function my_protocol.dissector(buffer, pinfo,tree)
-- Show the field in a subtree
local RtcidPcid_range = buffer(4,2) -- the 16-bit field
local ecpriRtcidPcid = ecpriRtcidPcid_range:uint()
subtree:add(RuPortId_F, RtcidPcid_range, RtcidPcid) -- the variable width sub-field
The trouble with this is that the preference is only read at startup. A new value can't be specified by the user without restarting Wireshark to apply it.