Ask Your Question

Is there a Lua file that defines the Wireshark API globals?

asked 2021-05-21 09:04:26 +0000

Roddyp gravatar image

I'm developing Lua dissectors in VSCode and having to manually add the Wireshark globals like Proto,ProtoField, DissectorTable in the VSCode Lua plugin settings, to avoid 'undefined global' warnings in VSCode.

Is there an existing Lua file that contains these as definitions (ideally with doc comments) that I can use?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2021-05-25 15:09:03 +0000

Chuckc gravatar image
edit flag offensive delete link more


Yes, that was my q on github :) I now know how to define the globals, but I'm asking if there's an existing file that contains them for Wireshark. If not, I've made a stub one already but would prefer not to reinvent the wheel.

Roddyp gravatar imageRoddyp ( 2021-05-25 15:14:14 +0000 )edit

There was another request for this: [Wireshark-users] What is the Wireshark lua package path? - so thought it might help others to add a link to the answer on Github.

The Lua API Reference Manual section in the Developer's Guide is automatically generated from the code during the docbook build process with
Perhaps a Lua definitions file could be automatically generated during the build process and is worthy of an enhancement or feature request.

Chuckc gravatar imageChuckc ( 2021-05-25 16:00:58 +0000 )edit

Thankyou. Ideally the generated file would contain annotations for parameters, etc - unfortunately, there's no single standard for this with Lua. LDoc is very common, but the particular VSCode extension we're using uses EmmyDoc instead.

Roddyp gravatar imageRoddyp ( 2021-05-25 16:29:48 +0000 )edit

I have a "work in progress" here.

It looks like the perl script creates autodoc files directly, not XML?

Roddyp gravatar imageRoddyp ( 2021-05-26 10:32:15 +0000 )edit

It is a bit confusing - the comments mention XML but my build directory is all .adoc files.
I think you will get better answers on the wireshark-devmailing list.
And maybe add a link to your github page on the Wireshark Wiki Lua page. More working exampes of Wireshark Lua scripts are a great resource when creating new ones.

Chuckc gravatar imageChuckc ( 2021-05-26 14:13:48 +0000 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2021-05-21 09:04:26 +0000

Seen: 82 times

Last updated: May 25