Huge thanks to our Platinum Members Endace and LiveAction,
and our Silver Member Veeam, for supporting the Wireshark Foundation and project.

Wireshark-dev: Re: [Wireshark-dev] Lua embedded into C++

From: Peter Wu <peter@xxxxxxxxxxxxx>
Date: Wed, 1 Feb 2017 19:48:40 +0100
On Wed, Feb 01, 2017 at 06:38:52PM +0100, Pascal Quantin wrote:
> 2017-02-01 18:18 GMT+01:00 Kunal Thakrar <kunalthakrar@xxxxxxxxxxxxx>:
> 
> > Hi Pascal,
> >
> >
> > What I am trying to do is register the wslua functions in my Lua state in
> > order to create my own scripts which will be used internally as part of my
> > customised module. My module aims to use listeners and post dissectors to
> > show information similar to google chrome and firefox's developer's tools
> > and I feel more comfortable creating scripts using wslua as opposed to
> > going straight through C and C++.
> >
>  And as I explained, I cannot guarantee you that you have any chance to
> have it working. We would need to get a feedback from the Wireshark
> developers working on Lua.

The classes includeed with the WSLUA API are not designed to be
registered with multiple users. If you are lucky, it sometimes does not
work as expected (due to shared global variables, registrations to other
parts of the dissector APIs), if you are unlucky it will just crash.

If you are working in Lua, have you considered using the Lua API to
create menu items and use a tap listener to process packets? Docs:
https://www.wireshark.org/docs/wsdg_html_chunked/wsluarm_modules.html
https://www.wireshark.org/docs/wsdg_html_chunked/wslua_tap_example.html

If these APIs are too limiting for your purpose, or if you still want to
invoke Lua from your scripts, perhaps you could try to clarify what you
are trying to do? Maybe there is another way.
-- 
Kind regards,
Peter Wu
https://lekensteyn.nl