ANNOUNCEMENT: Live Wireshark University & Allegro Packets online APAC Wireshark Training Session
April 17th, 2024 | 14:30-16:00 SGT (UTC+8) | Online

Wireshark-bugs: [Wireshark-bugs] [Bug 4700] WSLUA improvement (ProtoField.bool extension)

Date: Mon, 1 Nov 2010 19:38:29 -0700 (PDT)
https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=4700

--- Comment #24 from Tamas Regos <tamas.regos@xxxxxxxxxxxx> 2010-11-01 19:38:23 PDT ---
Here is a working option, please let me know if you'd need more.

  -- ProtoField.bool has been changed, it has more flexibility now
  -- http://www.wireshark.org/docs/wsug_html_chunked/wsluarm_modules.html
  -- 11.4.6.6.13. ProtoField.bool(abbr, [name], [display], [string], [mask],
[desc])

  local F_test    = ProtoField.bool("myproto.test", "Testing bool field",
BASE_NONE, tfs_true_false, 0, "description")
  postDASP_dissector.fields = { F_test, ... }   

    -- Add our extra protocol subtree
    local subtreeitem = treeitem:add(myproto_dissector, tvb(),"MyProto
Postdissector")
    -- You can skip the set_text if you put it text in add like above
    --subtreeitem:set_text("MyProto Postdissector")

    -- TEST
    -- you need to use integer.
    -- if the value comes from tvb then you can get the value from there
    -- e.g tvb(0,4):uint()
    local tval = 0
    local tst = subtreeitem:add(F_test, tvb(), tval)
    -- you don't need the set_text for the field because it is in the
declaration above.
    --tst:set_text("Testing bool field: " .. tostring(tval))

-- 
Configure bugmail: https://bugs.wireshark.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.